Go Down

Topic: Base prefix notation (Read 2 times) previous topic - next topic

KeithRB

The leading zero and 0x notation is only used for integers, so the presence of a decimal point changes the game so to speak.

While the months are not part of the language, they are part of the time.h suite of the standard library - which is defined byt he standard. K&R are very careful to point out that the months number represents the "months since January" (italics in original). Harbison and Steele point out the same distinction - which probably came from unix.

AWOL

I guess I just don't get the hostility to zero-origin indexing.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

odometer


I guess I just don't get the hostility to zero-origin indexing.


It is not hostility to zero-origin indexing so much as hostility to a gotcha. Programming is hard enough without gotchas.

As for zero-origin indexing: following your logic, why aren't the days within each month numbered starting from zero?

AWOL

Quote
following your logic,

Read my sig  ;)
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

KeithRB

Because they are already numbered.

Note that the days of the week (tm_wday) are "days since sunday". (0-6)
Days of the year (tm_yday) are "days since Jan 1". (0-364/365)

Actually the day of the month one is the wired one since it is the only one not stated as x since y.

Go Up