Thread: [Dev-C++] help files and Operator Precedence
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Eric <eri...@cl...> - 2004-12-11 14:12:17
|
Hi I belong to a micro-controller group, someone in the group presented a formula (which might not be the problem to their question) x = ((((mm-1)*31)+dd)-1)%8; y = ((((mm-1)*31)+dd)-1)/8; I told them it could be written as x = ((mm-1)*31+dd-1)%8; y = ((mm-1)*31+dd-1)/8; if they look on the "Operator Precedence chart" it took me a while to remember I had printed off the Operator Precedence chart from the Borland help files, for my own C++ notes (while I was at C++, school) While you can find the Operator Precedence chart on Internet with the help of Google, a couple of web sites I have seen does not tell that most Operator Precedence level (16 in all) go from left to right, but there are three that go from right to left, level 2, 13 and 15. Hand written on the bottom of the page is a reminder local variables take precedence over global variables (I was at school at the time when I wrote the notes, OK) The Aim of this posting is a suggestion this could included in the (dev-C++) help files on future upgrades unless I am using a old version you can correct me and I would be grateful. From Eric Richards --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.809 / Virus Database: 551 - Release Date: 09-Dec-04 |
|
From: Per W. <pw...@ia...> - 2004-12-11 14:28:07
|
Knowing thee precendence rules are part of basic programming skills. Anyway, there are _no_ precedence difference between auto and global variables when evaluating an expression. There is, of course, a difference in the time when the constructors/destructors will be run for variables declared global, auto or dyanmically allocated. /Wer W On Sun, 12 Dec 2004, Eric wrote: > Hi I belong to a micro-controller group, > > > someone in the group presented a formula (which might not be the problem to their question) > x = ((((mm-1)*31)+dd)-1)%8; > y = ((((mm-1)*31)+dd)-1)/8; > > > I told them it could be written as > x = ((mm-1)*31+dd-1)%8; > y = ((mm-1)*31+dd-1)/8; > > > if they look on the "Operator Precedence chart" > > it took me a while to remember I had printed off the Operator Precedence chart from the Borland help > files, for my own C++ notes (while I was at C++, school) > > While you can find the Operator Precedence chart on Internet with the help of Google, a couple of web > sites I have seen does not tell that most Operator Precedence level (16 in all) go from left to right, > but there are three that go from right to left, level 2, 13 and 15. > > > Hand written on the bottom of the page is a reminder local variables take precedence over global > variables (I was at school at the time when I wrote the notes, OK) > > > > The Aim of this posting is a suggestion this could included in the (dev-C++) help files on future > upgrades unless I am using a old version you can correct me and I would be grateful. > > > >From Eric Richards > > > > > > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.809 / Virus Database: 551 - Release Date: 09-Dec-04 > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://productguide.itmanagersjournal.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Eric <eri...@cl...> - 2004-12-11 14:49:10
|
OK It is just that I don't do C++ full time nor do I programming micro-controller with C full time, A employment option in ether direction would be great !!! :) This is why I have kept the C++ notes in folder and refer to them and upgrade them from time to time as needed, The only reason why I made a posting is so I could find (and others as well) the operator precedence order in the help file if I need to and don't have access to my notes, I am sure you Per Westermark would not need them but other people might find it useful and stop them posting to this group on a trivial problem using operator precedence. After all I did see a "Hello world" example in the help files briefly while looking for something else. Also I do realize that operator precedence (and did while I was at school) that the operator precedence does not change between local and global variables, it was (it the time) a reminder that in a function a global variable would be ignored if there was a local variable defined in that function. From Eric ----- Original Message ----- From: "Per Westermark" <pw...@ia...> To: "Eric" <eri...@cl...> Cc: <dev...@li...> Sent: Sunday, December 12, 2004 3:27 AM Subject: Re: [Dev-C++] help files and Operator Precedence Knowing thee precendence rules are part of basic programming skills. Anyway, there are _no_ precedence difference between auto and global variables when evaluating an expression. There is, of course, a difference in the time when the constructors/destructors will be run for variables declared global, auto or dyanmically allocated. /Wer W On Sun, 12 Dec 2004, Eric wrote: > Hi I belong to a micro-controller group, > > > someone in the group presented a formula (which might not be the problem to their question) > x = ((((mm-1)*31)+dd)-1)%8; > y = ((((mm-1)*31)+dd)-1)/8; > > > I told them it could be written as > x = ((mm-1)*31+dd-1)%8; > y = ((mm-1)*31+dd-1)/8; > > > if they look on the "Operator Precedence chart" > > it took me a while to remember I had printed off the Operator Precedence chart from the Borland help > files, for my own C++ notes (while I was at C++, school) > > While you can find the Operator Precedence chart on Internet with the help of Google, a couple of web > sites I have seen does not tell that most Operator Precedence level (16 in all) go from left to right, > but there are three that go from right to left, level 2, 13 and 15. > > > Hand written on the bottom of the page is a reminder local variables take precedence over global > variables (I was at school at the time when I wrote the notes, OK) > > > > The Aim of this posting is a suggestion this could included in the (dev-C++) help files on future > upgrades unless I am using a old version you can correct me and I would be grateful. > > > >From Eric Richards > > > > > > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.809 / Virus Database: 551 - Release Date: 09-Dec-04 > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://productguide.itmanagersjournal.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.809 / Virus Database: 551 - Release Date: 09-Dec-04 |