This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/16911] New: Proposed GNU C extension: ->= assignment operator


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]