Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c++,comp.lang.c Subject: Re: Text editor project in C Date: Tue, 27 Apr 2021 09:20:04 -0700 Organization: None to speak of Lines: 32 Message-ID: <871ravbsy3.fsf@nosuchdomain.example.com> References: <877dkohi65.fsf@bsb.me.uk> <1bv9871zql.fsf@pfeifferfamily.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="a57ae5a4f402968e927cf79882d3975a"; logging-data="17348"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18u/fkJdNYVuQgFLDMBRV08" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cancel-Lock: sha1:U+u7fINGP6KvVd9wyOOuSbc0tPA= sha1:gep6iBrAeFWLgbvYBf70mLPIcM0= Xref: csiph.com comp.lang.c++:79332 comp.lang.c:160406 Joe Pfeiffer writes: > Juha Nieminen writes: >> However, the undetermined size of basic types (especially before >> standardization) makes it more likely for C programs, especially ones >> written back then, to be non-portable. Sure, even back when K&R first >> "soft-standardized" the C language you shouldn't have assumed a certain >> size for any basic type. > > Everybody "knew" longs were 32 bits, shorts and ints were both 16 bits, > chars were 8 bits and we coded under that assumption. Lots and lots of > code broke when we moved from 16 bit to 32 bit machines and the size of > an int changed as a result. Everybody who programmed on PDP-11s knew that. There were other configurations at least as early as K&R1, 1978. But most programmers at the time probably wouldn't have worked on more than one system. > > >> I suppose the conclusion is that maybe C code written in the 70's does >> compile and work today... but only if it was properly written. If it >> wasn't properly written, it's perfectly possible it won't work today, >> in a different architecture than it was originally written for >> (for example because it assumes the wrong size for 'int'.) > > Correct (as those of us who are old enough learned in the 80s!). > -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips Healthcare void Void(void) { Void(); } /* The recursive call of the void */