Code Comments
Programming Forum and web based access to our favorite programming groups.In article <217e491a.0411151053.78a6954d@posting.google.com>, riplin@Azonic.co.nz (Richard) writes: > Robert Wagner <spamblocker-robert@wagner.net> wrote > > > Who by, Robert ? C is a low-level, value-orientated language that can > be used _instead_ of assembler as a portable language for systems > programming. > > What basis do you have for your belief that your nonsense is 'widely > believed'. Actually it just suits you to make this up. Actually, we recently had a blow-up in alt.folklore.computers over this very topic.[1] There were some advocates of the "C is portable assembly" thesis - experienced programmers with significant C knowledge (though not, I'm afraid, up to comp.lang.c's standard of language-lawyering). > > Yes it is. C's built in types are no more nor less than the machine's > types, there is a direct correspondence on each machine. Not true. There are conforming C implementations with CHAR_BIT==8 on machines that do not have direct octet operations, for example. (The ones I've seen documented on comp.lang.c are byte-addressable, in that addresses refer to bytes, but operations on individual bytes are implemented as word load / mask / store sequences.) On the AS/400, C compiles to MI, which does not directly correspond to the hardware. > One can also > request that a particular variable be 'register' or 'volatile'. Note that conforming implementations do not need to do anything meaningful with either the "register" storage-class specifier (other than enforcing certain constraints, such as disallowing taking the address of a variable with that sc-specifier) or the "volatile" type- qualifier (again, other than some syntactic constraints). An implementation is free to treat "register" as having no semantic effect whatsoever. On initial inspection "volatile" appears somewhat stronger, because of the "access" rules (see ISO 9899-1990 6.5.3 and its equivalents in later standards), but there's an escape clause: "What constitutes an access to an object that has volatile-qualified type is implemen- tation-defined". In other words, "correct" volatile semantics are purely a quality-of-implementation issue, and a conforming implemen- tation can utterly disregard the volatile qualification. Certainly, C was originally developed to be a low-level language, and it remains low-level by various metrics. But the C language per se is not required to be "close to the metal". The referenced alt.folklore.computers thread goes into this question ad nauseum. 1. See the subthread beginning with message http://groups.google.com/groups?sel...s3.newsguy.com. -- Michael Wojcik michael.wojcik@microfocus.com Auden often writes like Disney. Like Disney, he knows the shape of beasts - - (& incidently he, too, might have a company of artists producing his lines) -- unlike Lawrence, he does not know what shapes or motivates these beasts. -- Dylan Thomas
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.