Casting pointers

Andrew Koenig ark at alice.UUCP
Fri Jul 20 23:58:11 AEST 1990


In article <1614 at ghost.stsci.edu>, davids at stsci.EDU (David Silberberg) writes:

> Does anyone know if the following cast operation will perform correctly?

> 	(char *)ptr += num_chars;

This is not legal C -- the result of a cast is not an lvalue -- so the
`correct' thing to do is to issue a diagnostic message during compilation.
Some implementations do this, others don't.
-- 
				--Andrew Koenig
				  ark at europa.att.com



More information about the Comp.lang.c mailing list