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/61815] New: precedence of operators is not being followed


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61815

            Bug ID: 61815
           Summary: precedence of operators is not being followed
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: saisusheelsunkara at hotmail dot com

int i=3,y;
y=++i*++i*++i;
printf("%d",y);


here the output being printed is 150? but as per precedence of operators the
output must have been 216 but instead of considering precedence they are simply
excuting in the order they are to be done in the evaluation of postfix notation
where operands like ++i are treated literaly as a string.

where as on performing
y=++i*++i;
the output i am getting is 25 which is as per precedence of operators in c


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