News for hackers. Stuff that matters.
Re:Linux Eliminates the Strncpy API After Six Years of Work,... by PlunderBunny on Saturday June 20, 2026 @05:40PM (#48613231)
I worked on a Win32 app that used space-padded strings, i.e. the destination string was padded with spaces, but there was still a null on the last byte. You had to use special versions of the string functions for length, copy etc.

I’m not sure why this was - the source base was so old it might have had its origins in Pascal struct behaviour.

Re:Linux Eliminates the Strncpy API After Six Years of Work,... by jkfkfkj on Saturday June 20, 2026 @06:33PM (#48613612)
It can perhaps be due to the string originating from a sql database ”char” field, I.e. not ”varchar”. Char fields in databases are space padded.
Re:Linux Eliminates the Strncpy API After Six Years of Work,... by bebe83939 on Saturday June 20, 2026 @06:06PM (#48613429)
Perhaps prevent realocation when string size changes? Or aligning cpu cache lines?
Re:Linux Eliminates the Strncpy API After Six Years of Work,... by egorfine on Saturday June 20, 2026 @05:47PM (#48613286)
I think this behavior has its roots in COBOL, not pascal.
Re:Linux Eliminates the Strncpy API After Six Years of Work,... by kps on Saturday June 20, 2026 @07:36PM (#48614136)
Which has its roots in punch cards, where pre-computer hardware operated on fixed-sized fields and an unpunched column is equivalent to a space.