Path: utzoo!mnetor!uunet!nbires!hao!noao!mcdsun!fnf From: fnf@mcdsun.UUCP (Fred Fish) Newsgroups: comp.sys.amiga Subject: Re: Amiga programmer's hint $14 Message-ID: <707@mcdsun.UUCP> Date: 22 Feb 88 23:27:10 GMT References: <4230019@hpfclq.HP.COM> <340@sas.UUCP> Reply-To: fnf@mcdsun.UUCP (Fred Fish) Organization: Motorola Microcomputer Division Lines: 23 In article <340@sas.UUCP> toebes@sas.UUCP (John Toebes) writes: >Under 4.0 (which supports short integers) the compiler will complain with >error 101 whenever you do this. I have seen too many people get bit by >this on the PC to let it happen on the Amiga with Lattice. The basic >rule is that if you ever convert a 16 bit entity to a pointer *REGARDLESS >OF ANY CAST* it will issue the error message. This will catch almost This really should be discussed on comp.lang.c, but I'd like to note that traditionally, a cast has been used to tell the compiler that the programmer really DOES understand what he is asking for, and what the expected results will be. In the example program given, the programmer obviously didn't understand that casting the result of the function call to a pointer, when the result was a short, didn't automatically magically turn the function into one that returned a 32 bit value rather than 16. Breaking the compiler to catch broken programs does not seem like the optimal solution. I could support generating a warning message here, but NEVER an error, and only generating a warning when the compiler was specifically requested to flag such questionable constructs. -Fred -- # Fred Fish hao!noao!mcdsun!fnf (602) 438-3614 # Motorola Computer Division, 2900 S. Diablo Way, Tempe, Az 85282 USA