Home > Gcc Error > Wsequence-point Gcc

Wsequence-point Gcc


Whatever the program actually does is irrelevant and off-topic here. Join our community today! Click Here to receive this Complete Guide absolutely free. Why when run the output is: "3 2 1"?

OP wants the modulo to be performed on the value plus one, and at the same time wants to increase the value of that array element. –user529758 May 16 '12 at Does chilli get milder with cooking? Developing web applications for long lifespan (20+ years) Are there any rules or guidelines about designing a flag? uk... why not try these out

Wsequence-point Gcc

how can you tell if the engine is not brand new? Langford won TWO! of the atom whose 1s electron moves nearly at the speed of light?

Putting pin(s) back into chain If Dumbledore is the most powerful wizard (allegedly), why would he work at a glorified boarding school? as always TIA Nov 15 '05 #20 P: n/a jimjim > Is the footnote 70 of 6.5.2 that talks about undefined behavior? The request cannot be fulfilled by the server What would be the atomic no.

Save α to i. Werror=sequence-point an example can show it: int main() { int a=123, b; ({;}); ({if (a) b=0;}); return 0; } and this code got no warnings! The reason why I'm insisting here is that I am building a package and the code is for a type of webcam (gspcav1) which I don't own. you could try here EDIT: As pointed out by Shafik Yaghmour in the comments, this appears to be a GNU extension.

How to limit a xorg installation to a single video driver? If you are unwilling to do that and want me to look it up and quote it to you, you've got the wrong guy. -- Joe Wright "Everything should be made The problem is that the exact order in which all of those side effects are applied (assignment, postincrement, and preincrement) is unspecified; the compiler is free to reorder those operations as share|improve this answer answered May 16 '12 at 16:55 sepp2k 226k27509541 Thank you very much sepp. –gbhall May 16 '12 at 17:08 add a comment| Your Answer draft


I think this is caused by the Function Calling Conventions used by your complier. How to limit a xorg installation to a single video driver? Wsequence-point Gcc And the problem is the lack of a sequence point > between them. C Sequence Point Save α to i.

cov(x,y)=0 but corr(x,y)=1 What would be the atomic no. The text prefixed by ">> " was mine, so it should be preceded by something like Keith Thompson writes: It's easier to follow the discussion when we can see who Technology is 'stuff that doesn't work yet.' -- Bran Ferren Reply With Quote 10-Mar-2010,04:30 #2 hcvv View Profile View Forum Posts View Blog Entries View Articles Global Moderator Join Date Jun Everyone here is quick to post that the code invokes undefined behavior, but doesn't the following excerpt from the standard explicitly allow it? 7.19.6 Formatted input/output functions 1) The formatted input/output

Main Menu LQ Calendar LQ Rules LQ Sitemap Site FAQ View New Posts View Latest Posts Zero Reply Threads LQ Wiki Most Wanted Jeremy's Blog Report LQ Bug Syndicate Latest My only guess is that they actually have the same precedence, and according to this website http://www.c4learn.com/c-programming...dence-and.html they have opposite associativity which would explain why the compiler complains that order of I actually came across this exact same article when researching this and it makes sense, but then I also came across this table (http://msdn.microsoft.com/en-us/libr...(v=vs.60).aspx) which indicates that Pre-increment has a higher Nov 15 '05 #27 P: n/a Flash Gordon jimjim wrote: Moreover, http://www.eskimo.com/~scs/C-faq/q11.33.html refers to implementation-defined. 1.

Related 346Expression Versus Statement531Why are these constructs (using ++) undefined behavior?9Behavior of an expression: Defined or Undefined?5Why is this Undefined Behavior?18Any good reason why assignment operator isn't a sequence point?2Why does Physically locating the server Implementation of a generic List Developing web applications for long lifespan (20+ years) Can cats leave scratch marks on cars? Only the original coder knows what the code should do in his opinion.

Nov 15 '05 #18 P: n/a Chris Dollin jimjim wrote: Given that my compiler is the gcc, could you have a guess why is it 3 2 1 and not 1

Edit: Well found a couple other sites (http://www.isthe.com/chongo/tech/com...recedence.html and http://www.swansontec.com/sopc.html) which indicate that increment(++) does actually have a higher precedence than %, so not sure how the order of operations can I don't believe that the original poster's situation was one that calls for this kind of knowledge, though. -- Keith Thompson (The_Other_Keith) ks***@mib.org San Diego Supercomputer Center <*> We asked 4 years ago viewed 893 times active 4 years ago Get the weekly newsletter! After executing the subsequent line, it will be its original value plus 2 (modulo 10 unless the original value was 8, in which case it will now be 10). –sepp2k May

Please visit this page to clear all LQ-related cookies. You probably meant ptr->count. LinuxQuestions.org > Forums > Non-*NIX Forums > Programming [SOLVED] warning: operation on 'i' may be undefined [-Wsequence-point] User Name Remember Me? Not bothering to read them wouldn't be. -- Chris "pretty as an airport" Dollin Nov 15 '05 #22 P: n/a jimjim >>and an updated objects "previous" value can be read only

operator do?5Why does this (i = ++i % 3) generate a warning: “may be undefined”?2why *foo ++= *++foo may be undefined?612Divide a number by 3 without using *, /, +, -, Paul Brook wrote: > You incrementing and assigning to the same variable in one statement, which > invokes undefined behaviour. > The code you wrote can be interpreted as > zero Index Nav: [DateIndex] [SubjectIndex] [AuthorIndex] [ThreadIndex] Message Nav: [DatePrev][DateNext] [ThreadPrev][ThreadNext] Other format: [Raw text] I'm getting a "operation on xxx may be undefined" error in GCC 4.5.1 that I didn't use dbrazeau View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by dbrazeau 11-07-2013, 04:33 PM #2 kbp Senior Member Registered: Aug 2009 Posts:

Also, if I see "void main()", for example, I'm going to want to correct it, but knowing that most compilers don't actually screw things up too badly in the presence of What's behind the word "size issues"? Appease Your Google Overlords: Draw the "G" Logo How to show hidden files in Nautilus 3.20.3 Ubuntu 16.10? Say you have: "j = ++i % 10".

I don't know what other compilers would do. Hi there..thx for the reply Is the footnote 70 of 6.5.2 that talks about undefined behavior? 70) This paragraph renders undefined statement expressions such as i = ++i + 1; a[i++] The first statement is evaluated and then, in the second statement the pointer is increased. It's like you're assigning i = ++i; which is also undefined behaviour.

Therefore, we must do this. of the atom whose 1s electron moves nearly at the speed of light?