This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/16911] New: Proposed GNU C extension: ->= assignment operator
- From: "a dot guru at sympatico dot ca" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Aug 2004 06:10:27 -0000
- Subject: [Bug c/16911] New: Proposed GNU C extension: ->= assignment operator
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This is not a bug, but a simple proposed extension for GNU C,
in light that it already has extensions like the
x ?: y
construct. I often use this construct
p = p->next
in cases where p is a complex expression.
Being able to say
p ->= next
would be nice, especially in for loops. It would be equivalent
in semantics, except that side effects on p which would occur
once instead of twice.
(Of course, one could also suggest
cond1 &&= cond2
if (cond1 && !cond2) cond1 = 0
cond1 ||= cond2
if (!cond1 && cond2) cond1 = 1
like Perl has (with slightly different semantics in the second
case: replace 1 by cond2). Having
mask ~=
mask = ~mask
is also possible, but it would be a postfix unary operator.)
--
Summary: Proposed GNU C extension: ->= assignment operator
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: a dot guru at sympatico dot ca
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16911