Live data from Hacker News

Pretty.c

github.com

41–50 of 227 posts

Re: Pretty.c

#41
post #35

Reminds me of a C++ codebase I once had to inspect that was entirely written as if it were written in Java. With camelcase naming for everything, getters and setters for every class variable, interfaces everywhere.

You ain't seen nothin. Check out the bourne shell source code from unix seventh edition. https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd... I can't believe it's not ALGOL.

Wow, I was not expecting that! Was this style of C common back then?

Before he wrote the Bourne shell the author wrote an ALGOL compiler, and ALGOL inspired Bourne syntax:

https://en.wikipedia.org/wiki/ALGOL_68C

Re: Pretty.c

#43

Reminds me of a C++ codebase I once had to inspect that was entirely written as if it were written in Java. With camelcase naming for everything, getters and setters for every class variable, interfaces everywhere.

I had that as well but also Java passes strings in as f(String *) so the C++ code was f(new String("Hello")

Re: Pretty.c

#44
post #34
post #32

> ifnt for if(!...). "unless" seems more readable than "ifnt".

Another bikeshed is the infinite for(;;) loop being called "always" I've seen "loop" in other languages. But Qt calls it "forever", and that is indeed very pretty. Very Qt, even

> I've seen "loop" in other languages. But Qt calls it "forever", and that is indeed very pretty. Very Qt, even

You can break a "forever" loop so I think "loop" is a better name.

Re: Pretty.c

#45
post #35

Earlier quoted context omitted.

You ain't seen nothin. Check out the bourne shell source code from unix seventh edition. https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd... I can't believe it's not ALGOL.

Wow, I was not expecting that! Was this style of C common back then? Before he wrote the Bourne shell the author wrote an ALGOL compiler, and ALGOL inspired Bourne syntax: https://en.wikipedia.org/wiki/ALGOL_68C

There were article suggesting #define BEGIN { and #define end }; to make C look more like Pascal.

I think in Europe C was not as common as other languages at the time so the terseness looked odd.

Re: Pretty.c

#46
post #11
post #8

`equal(0.3, 0.2 + 0.1); // true` how is this wizardry possible?

Is What Every Computer Scientist Should Know About Floating-Point Arithmetic wrong ??!! addendum: why are obviously rhetorical questions are taken so literally here?

It's meant as both humorous and a nerd snipe :)

Re: Pretty.c

#48
post #35

Reminds me of a C++ codebase I once had to inspect that was entirely written as if it were written in Java. With camelcase naming for everything, getters and setters for every class variable, interfaces everywhere.

You ain't seen nothin. Check out the bourne shell source code from unix seventh edition. https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd... I can't believe it's not ALGOL.

https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd...

wow.

thanks for this gem.

Re: Pretty.c

#50
post #34
post #32

> ifnt for if(!...). "unless" seems more readable than "ifnt".

Another bikeshed is the infinite for(;;) loop being called "always" I've seen "loop" in other languages. But Qt calls it "forever", and that is indeed very pretty. Very Qt, even

    #define ever ;;
    for(ever) {}
Post reply on HN