Re:Few lesser known tricks, quirks and features of C
by wruza on Saturday July 01, 2023 @11:57PM
(#36558079)
Also “lesser known” means “not in C FAQ” to me. Half or more of TFA is a pretty regular C FAQ material that everyone C already has read. I mean, sure, right?
[ Parent
| on HN ]
Re:Few lesser known tricks, quirks and features of C
by defrost on Sunday July 02, 2023 @12:08AM
(#36558126)
Pretty much.
Although even things in the C FAQ get overlooked and forgotten.
eg: a 'Day of the Week' one liner such as
dow = (y + y/4 - y/100 + y/400 + m["-bed=pen+mad."] + d) % 7;
with int day (d), month (m), year (y) inputs and single int day of week output has a slight twist that causes a few head scratches for some.
Re:Few lesser known tricks, quirks and features of C
by zalyalov on Sunday July 02, 2023 @03:43AM
(#36559245)
That... that way to handle leap years can't possibly be right, can it? It doesn't account that you don't need to add the leap day of the current year if the day is before Feb 29