Learning how to program (23, permasaged)

18 Name: #!/usr/bin/anonymous : 2007-08-21 13:56 ID:OvZh1M8r

>>17
1: Ah yes. It obeys much the same syntax as a pointer, yet isn't one. The wonders of modern C, but hardly worse than the old standby, *(p + i), for pointer subscripts. Still, it's easy enough to look at the variable's declaration and proceed from there. A pointer-to-pointer sort of implies that it is a pointer to a pointer variable or equivalent anyway. Most people, I'd think, would rather live with a a rarely hit special rather than the classic pointer subscript syntax (which I personally find rather nigh to obfuscation).

2: My personal pet peeve with C, that string literals are not "const char *" by default. To think that this was for historical reasons that would've been overcome had the change been made in C89... Still, hands off string literals seems like a simple enough policy to follow. Initialization of an array from a literal shouldn't give even newbies pause after the first time.

3: I don't think your case of accessing a string literal before its first byte is permitted, though not having read the standard recently I could just as well be wrong. It'd seem that the minus first would go into some ill-defined place in the process' text section, which far as I'm concerned pretty darn well counts as undefined behaviour especially when that position is being modified. Unless the standard specifies that doing that must crash the program, which I rather doubt.

I may be in optimism mode today, however, my experience is that things are easier when one stops making them hard. (Your example with the integral types' ill-specifiedness in the standard for instance.) Like in any line of creative or semi-creative work, the artist is his own worst enemy. Yet any journey can be split up into kilometers, then meters, steps and so forth.

I do wish people wised the fuck up with regard to the quick fix thing. Oh well, experience beats any lecturer in the field of teaching... sadly some people only learn to bang their head on the wall harder. It would certainly be nice if the school system(s) made these lessons available to students as early as possible instead of shielding them from well-deserved disappointment.

This thread has been closed. You cannot post in this thread any longer.