Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!snorkelwacker!spdcc!merk!alliant!linus!mbunix!duncant From: duncant@mbunix.mitre.org (Thomson) Newsgroups: comp.sys.amiga.tech Subject: Re: __chip is evil Message-ID: <85006@linus.UUCP> Date: 28 Dec 89 00:02:37 GMT Sender: news@linus.UUCP Reply-To: duncant@mbunix.mitre.org (Thomson) Organization: The MITRE Corp. Bedford, MA Lines: 34 Those (misguided) individuals in favor of keywords such as __chip should check the ANSI standard. They will find that, in ANSI C, there is no such thing as __chip, and therefore a program which uses it is not an ANSI C program, and a compiler which accepts it is actually a compiler for a superset of ANSI C. On the other hand, the standard does include a #pragma keyword, and it seems clear that this is the method intended by the ANSI comittee for compilers to implement such gross things as specifying which type of memory some data structure should go in. Of course there will always be those who don't care about whether they are writing in "standard" C. As long as their code compiles with their compiler they are happy. This is OK for code which will never be distrubuted, but if you intend to pass your code arouknd PLEASE make an effort to conform to the standard. Regarding portability, the real problem here is a minor disgustingness with the Amiga architecture. It's a bit gross to only have part of the machine's address space accessible to the display hardware. It seems to me that the best way to solve the problem is not to use static allocation for structures which must be in chip memory. Instead, call AllocMem and ask for chip memory. This won't be portable to any other system which doesn't have an AllocMem routine, but at least it would be portable to any C compiler for the Amiga, and you don't have to use any #pragmas. But if you really want to have static allocation, #pragma is clearly the standard way to go. At least with #pragma someone reading the code knows that this is some implementation defined thing which can be ignored when attempting to understand the meaning of the code. By the way, I don't see anything in the ANSI standard which indicates that #pragma is not supposed to be used for anything which would alter the semantics of the program. (I've got a fairly old draft, maybe something was added??) Duncan Thomson