This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: use of cast expressions as lvalues is deprecated
- From: Andrew Haley <aph-gcc at littlepinkcloud dot COM>
- To: "Lyndon Oh" <lyndon dot oh at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 5 Nov 2007 09:34:28 +0000
- Subject: Re: use of cast expressions as lvalues is deprecated
- References: <ddee0dd60711040743l29fdea60xd65db6e1a4510ff4@mail.gmail.com>
Lyndon Oh writes:
> Hi,
>
> I keep having this error when i upgraded my old gcc compiler.
>
> in macro.h
> #define FOR_EACH( p, p_list, action ) \
> { \
> PROTO_DATA *p_next; \
> for ( p = (p_list); p; (PROTO_DATA *) p = p_next ) { \
> p_next = (PROTO_DATA *) p->next; \
> LCHECK( p ); \
> (action); \
> } \
> }
>
> Is there anyway to work around this?
Something like
for ( p = (p_list); p; p = (typeof p)p_next )
will do it.
Andrew.