Live data from Hacker News

Pretty.c

github.com

101–110 of 227 posts

Re: Pretty.c

#102

Type names are nice; Perfect choice for the in-built func macros (like min); Len -- love it. Named boolean operators -- might be a bit much but go for it; Ternaries are illegible so you can only improve them; Not completely sold on all your loop definitions but some make sense to me; Resource tracking is impressive; The for... look a bit ugly -- could probably call it something else. All in all: quite a solid attempt…

Well, you don't have to use it all. My projects mostly use booleans, len(), max/min, and some operator aliases, because there wasn't much need for other tasty stuff yet. So give it a shot, even if for a couple of operator macros!

Re: Pretty.c

#104
post #68

I feel compelled to try it out in a serious way and contribute to it. I have strong knowledge of python and am learning C. Are there good reasons -apart from attracting the ire of c-programmers- to not use it?

Author here. I'll be glad to accept any contribution that makes C more readable, so PR away!

Re: Pretty.c

#108
post #94
post #73

Earlier quoted context omitted.

How did you think people outside the US learn programming?

setxkbmap us -option ctrl:swapcaps -option compose:rwin Problem solved. US layout, and with the right Window keys you can compose European characters.

There’s so many assumptions here about a person who’s starting to learn programming.

For starters, that they’re on Linux, they feel comfortable running complex CLI commands, they can memorize the U.S. layout just like that, and that they can type without looking at the physical keys (because changing the virtual mapping means keys produce something else than what the label says).

In reality, the learner’s first exposure to C family languages is more likely to be a website where you can run some JavaScript in a text box. And the first hurdle is to figure out how to even type {}. American developers just completely forget about that.

Re: Pretty.c

#109
post #93

The code asumes that C17 has C++-style auto ( https://github.com/aartaka/pretty.c/blob/master/pretty.h#L11... ), it does not (in C auto is storage specifier that is equivalent to no storage specifier).

C17 doesn't have auto, but C23 does, and thus my `__STDC_VERSION__ > 201710L` (notice the greater than sign, it doesn't include C17 itself.)
Post reply on HN