Message-Id: <199604120528.BAA00833@mail-e2b-service.gnn.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Fri, 12 Apr 1996 01:33:00 From: Jethro Wright To: djgpp AT delorie DOT com Subject: Re: A Proper Cast for a Funtio >> Or perhaps my comparison routine returns a long or char value. No >> prob, the cast is safe and there *is* an implicit conversion (ie. >> truncation or sign extension), but *I* know it's safe for the compiler >> to do. > >Unsafe, at least for the case that your fn returns a char. Actually, >there is NO implicit convertion. What will happen is that something >is viewed as some other type of thing. This is never regarded as a >convertion: your fn is returning a char, so the compiled code puts >the return value in AL, and returns. Qsort() is expecting an int, >so it checks EAX. Anyway, the high-order 24 bits of EAX could be >garbage, it could be neither signed, nor unsigned extended. Wang: Good point, as I overlooked that possibility. Truth is, I don't really use fn ptr coercion all that much, but decided to ask this time, since I've had a couple of occasions to use such a thing in that past couple of months and this was as good a time as any to learn about this bit of C obscurity.... Jet ======================================================================= The continued survival of the human race, despite its own stupidity, is the strongest argument for the existence of a benevolent God. =======================================================================