From mboxrd@z Thu Jan 1 00:00:00 1970 From: ron@ronnatalie.com (Ronald Natalie) Date: Thu, 24 Jan 2013 09:42:59 -0500 Subject: [TUHS] History of strncpy In-Reply-To: <20130124060205.GQ24498@bitmover.com> References: <1301231756.AA27240@ivan.Harhan.ORG> <20130123214651.GF22559@mercury.ccil.org> <20130124060205.GQ24498@bitmover.com> Message-ID: <1AFADE66-7F72-4776-8738-EC27748DAF33@ronnatalie.com> On Jan 24, 2013, at 1:02 AM, Larry McVo > As a SPARC guy (in the past), I think it may have had something to do > about alignment. > > That said, I hate the fread/fwrite interfaces. We're fixing them in > our stdio. freadn(f, buf, n). > Amen. For practical matters, there is no way given the rest of the library that an implementation can do anything other than multiply the two middle args together. The stream still needs to be a byte stream and passing things as void* sort of divorces any clue as to what alignment or other portability requirements are (and I've worked on C on some rather odd word sized machines like 36 and 60 as well as machines that encode the word size in the pointer... believe me there were TONS of bugs in 4BSD with regard to that one where they would stuff a char* into a union and retrieve it with a int* thwarting any possible conversion (as we put in place when you casted one pointer to other). It's not true that FILE went at the end, except in vararg'd functions. It goes at the beginning of ftell (which mimics the UNIX tell call). As with Larry, I'd much perferred they mimic'd most of the UNIX calls when possible. They were reasonably thought out.