Tonight's rabbit hole: time math and 32 bit longs
rachelbythebay.com
rachelbythebay.com
$domain =~ s/\.\s+$//;
This will chop off a trailing dot and any white space that follows but not a trailing dot without trailing whitespace. Is that really the intent? Also, it will turn `domain.com.. ` into `domain.com.` $domain =~ s/[^A-Za-z0-9.]+/-/g;
Won’t this change my—-domain.com
into my-domain.com
? Double dashes are particularly common in internationalized domain names (https://en.wikipedia.org/wiki/Internationalized_domain_name#...), and this mangles perfectly-valid ones.The first version of UNIX was written in assembly language for an 18-bit machine. C was invented as part of rewriting UNIX to work on a 16-bit machine and who knows what to expect after that. Machine architectures were a lot less uniform back in the day, and most of those minicomputers are easily beat by some of today's 20 cent microcontrollers.
Given that context, being able to loosely define relative data type sizes based on how efficiently they might be represented on the machine might make more sense.
But you're right, that's quite alien to where we are today.
By the 1980s, Ada was already making the right call of allowing the developer to specify the behavior and exact range of modular integer types for correctness and letting the compiler optimize things for efficiency or performance as needed. It'd be nice to see that approach become more popular.
Not sure if that’s “bad form” or not
https://news.ycombinator.com/item?id=34496287 (>130 comments)
https://perldoc.perl.org/perlre#Character-Classes-and-other-...
This may help get you started: https://en.wikipedia.org/wiki/Year_2038_problem
should have been
> return (long) ((t + DAY / 2) / DAY);
?
Amusing that it was broken by an attempt to make it clearer.
If the solution you need doesn't already exist, of course you need to write your own.
The README goes in some depth about kernel events and timestamps and time implementations on 32-bit vs 64-bit systems.
Ah but it won't, because signed integer overflow is undefined in C. It will make demons fly out your nose.
(gcc may make it return negative numbers, but clang may do something else.)
2147440447 -> 24855
2147440448 -> 24855