:: Re: [DNG] C Obfuscated code: a virt…
Inizio della pagina
Delete this message
Reply to this message
Autore: Peter Olson
Data:  
To: dng, Edward Bartolo
Oggetto: Re: [DNG] C Obfuscated code: a virtue or a vice?
> On July 15, 2016 at 1:23 AM Edward Bartolo <edbarx@???> wrote:

> The International Obfuscated C Code Contest, IOCCC was started by the
> "masters" and "pioneers" in C. This is a "competition" for those who
> take pride in compressing code to the point of making it practically
> unreadable.
>
> The following is a program submitted to IOCCC:
> http://www.ioccc.org/2015/dogon/prog.c


> At first, I was tempted to follow the path of writing obfuscated code,
> but thinking about it, with todays huge computers, it simple doesn't
> make sense to write difficult to read code. In the past there was an
> advantage of writing such code that saved on code size as RAM size was
> only a few kilobytes but definitely not today.


You misunderstand what the IOCCC is about. It's a game. Nobody trying to write useful code will do anything like what IOCCC writes.

> Here on this mailing list, I am noticing that being committed to write
> legible code, is interpreted as an inherent lack of coding ability.


I doubt you will find anyone at all on this list who criticizes legible code.

> In
> my case, irrespective of the attacks by some, and the fact that when I
> submitted functional code nobody commented about it,


I did. I made two suggestions:

1) Don't use bare semicolons in while/for constructs.

Use the continue statement instead.

2) when comparing to a literal (or a constant expression), put the literal on the left hand side of the boolean:

  if (value = literal)
    stuff;


when it is intended

  if (value == literal)
    stuff;


You can make this mistake, the compiler won't alert you, and you may spend hours trying to figure out what is wrong.

Instead do it like this:

  if (literal == value)
    stuff;


and not

if (literal = value)
    stuff;


which the compiler will flag as an error.

The compiler is your friend, if you help it a bit.

Peter Olson

> those who are attacking are only interested in making disguised
> personal attacks to dissuade me from helping in the project. The
> answer to these people is: I will continue to move on irrespective of
> your attacks.
>
> Edward
> _______________________________________________
> Dng mailing list
> Dng@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng