Live data from Hacker News

Infrequently Asked Questions in Comp.lang.c (1999)

seebs.net

41–45 of 45 posts

Re: Infrequently Asked Questions in Comp.lang.c (1999)

#41
post #40

Earlier quoted context omitted.

Just as a broken clock shows the correct time twice a day, you can use this syntax to input hexadecimal numbers less than 0A.

Less than 8 actually. 0 at the start of a number indicates it’s octal, so 08 and 09 are not syntactically valid numbers.

Though think they might be accepted if using pre-ansi standard. Remember reading that in the changes list in my 2nd edition copy of k&r

Re: Infrequently Asked Questions in Comp.lang.c (1999)

#42

After reading through this, I'm not sure if it's a list of jokes or real information? For example: > long ints can be entered using hexadecimal notation; for instance, > long int foo = 07; How is this a good example of hexadecimal input?

Most of the answers seem to contain bullshit. The one you quoted is wrong because the leading 0 is for octal notation, not hex

> Most of the answers seem to contain bullshit. The one you quoted is wrong because the leading 0 is for octal notation, not hex

Why do i find your anwer very funny ?

The answers are more informal than a proper one because they make you think and challenge the answer.

You shouldn't take every sentence as truth.

Re: Infrequently Asked Questions in Comp.lang.c (1999)

#44
post #34

Some great in-jokes there (hands up who gets the EBCDIC one). More seriously, a lot of the discussions about "undefined behaviour" seem to be aimed at the kind of code that no experienced engineer would write anyway. Until there's a language that's proved formally correct, every language is going to have "undefined" behaviour (though some languages - especially more modern ones - cover more cases/make it harder for l…

Half of it is code no engineer would write and the other half of it occupies 30% of any sufficiently old C codebase. And usually the only way you find out that your clever new optimization is going to break the latter is to write a lot of the former.

Re: Infrequently Asked Questions in Comp.lang.c (1999)

#45
Are the "[a]" footnotes also meant to be "subtly wrong" for shits and giggles?

Footnote 1.5 for instance sounds completely wrong, as if the author is mixing up definition for declaration, and initialisation for definition:

declaration: lets the compiler know the existence of a symbol and its type, without allocating memory for it yet or assign a value. Either of those can happen in a different compilation unit and linked after after the compilation stage. e.g.

  extern int bar;
definition: arguably a poor choice of name, but this is the point at which a definitive space in memory is reserved for this variable. If no previous declaration for this symbol has taken place, the symbol is also declared as above too. The value in the newly allocated memory is effectively garbage, since it has not been initialised at yhis step. E.g.

  int bar;
initialisation: the assigning of contents into the memory portion that has been allocated for that symbol.

  bar = 5;
simultaneous declaration, definition, and initialisation in a single step:

  int bar = 5;
Post reply on HN