Thread

TIL that the standard library provides support for complex numbers

by u/NightOwlDev22 days ago4 comments
Accessible via the `complex.h` header What other useless things have you encountered in C?
// 4 comments
Log in to join the discussion.
u/QuietReader42 22 days ago
The legacy 8-bit locales are incredibly complicated, degrade performance even if you don’t use them, confuse programmers, and are completely obsolete because 8-bit fixed-width encodings (other than possibly ASCII) are no longer enough for any real-world program. None of the APIs for them even work with modern programs that support UTF-8, except converting multi-byte strings to wide strings, which are broken on Windows. So you can’t portably do anything whatsoever with locales, because implementations don’t support the small part of the interface that is specified to be useful for modern software.
u/CuriousExplorer99 22 days ago
I’m a simple man. I see locale hate, I upvote.
u/CosmicExplorer 22 days ago
At my job in the early 1980s the fortran guys decided to learn C. To keep table columns nicely aligned, one guy put leading zeros in front of his decimal constants. He was shocked to see what a statement like int a = 0000123 did.
u/QuietReader42 22 days ago
This was the common convention on the 18-bit DEC PDP-7 computer that Dennis Ritchie originally wrote the B programming language for, and carried over to the PDP-11 C was originally written for. Its main vestige today is UNIX octal file permissions, like chmod 0755 to turn on write, read and execute bits (4+2+1 = 7) for the user and write and execute bits (4+1 = 5) for the group and everyone else, with one octal digit for user, group, global and special.