473,322 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

quick question about "++"

mdh
Given the expression:

while (isaspace(c = *s++))
x+1;
(s is an array)

Does the increment to 's' occur after "x+1" is evaluated, or after
the content of s is assigned to c? Is there a general rule as to when
this type of increment occurs? ( I understand that the increment in "c
= ++*s" occurs immediately before assignment, so my guess is the same
would apply in the "after" scenerio, but not sure).

thank you.

Jun 1 '07 #1
9 1186
On May 31, 7:29 pm, mdh <m...@comcast.netwrote:
Given the expression:

while (isaspace(c = *s++))
x+1;
(s is an array)

Does the increment to 's' occur after "x+1" is evaluated, or after
the content of s is assigned to c? Is there a general rule as to when
this type of increment occurs? ( I understand that the increment in "c
= ++*s" occurs immediately before assignment, so my guess is the same
would apply in the "after" scenerio, but not sure).
It's a FAQ:

4.3: Does *p++ increment p, or what it points to?

A: Postfix ++ essentially has higher precedence than the prefix
unary operators. Therefore, *p++ is equivalent to *(p++); it
increments p, and returns the value which p pointed to before
p
was incremented. To increment the value pointed to by p, use
(*p)++ (or perhaps ++*p, if the order of the side effect
doesn't
matter).

References: K&R1 Sec. 5.1 p. 91; K&R2 Sec. 5.1 p. 95; ISO
Sec. 6.3.2, Sec. 6.3.3; H&S Sec. 7.4.4 pp. 192-3, Sec. 7.5 p.
193, Secs. 7.5.7,7.5.8 pp. 199-200.

Jun 1 '07 #2
mdh wrote:
Given the expression:

while (isaspace(c = *s++))
x+1;
(s is an array)
Therefore, a diagnostic is required. Please -- PLEASE! --
study Section 6 of the comp.lang.c Frequently Asked Questions
(FAQ) list at http://c-faq.com/ before posting such nonsense
again. (Or "again-again," as it seems you are a repeat offender.)
Does the increment to 's' occur after "x+1" is evaluated, or after
the content of s is assigned to c?
If `s' were incrementable (which you say it is not), it
would be incremented before `x+1' is evaluated, and at some
indeterminate time with respect to the assignment of a new
value to `c'.
Is there a general rule as to when
this type of increment occurs?
Yes: At some unspecified time after the preceding sequence
point and before the following sequence point.
( I understand that the increment in "c
= ++*s" occurs immediately before assignment, so my guess is the same
would apply in the "after" scenerio, but not sure).
You might just as well "understand" that the Moon is made
of green cheese. There is *no* temporal relationship between
the incrementing of `*s' and the assignment of a new value to
`c'. Both occur after the preceding sequence point and before
the next sequence point, but they may occur in any order with
respect to each other -- even simultaneously or overlapped in
time so the notions of "before" and "after" are meaningless.
If you "understand" some more specific ordering, your thoughts
are of phantasms and chimeras.

--
Eric Sosman
es*****@acm-dot-org.invalid
Jun 1 '07 #3
mdh
On May 31, 8:10 pm, Eric Sosman <esos...@acm-dot-org.invalidwrote:
>
Therefore, a diagnostic is required. Please -- PLEASE! --
study Section 6 of the comp.lang.c Frequently Asked Questions
(FAQ) list athttp://c-faq.com/before posting such nonsense
again.
>
You might just as well "understand" that the Moon is made
of green cheese. There is *no* temporal relationship between
the incrementing of `*s' and the assignment of a new value to
`c'.
Eric, I am not about to bite the hand that feeds me, but I DO look at
the FAQs but nowhere did I get a great explanation of the real issue
that was causing the problem to come up.....ie the fact that
*temporal relationships* play no role. Sometimes asking what some
might consider an obviously erroneous idea, may not be that obvious to
the poster. I try and post what I think not because I want to show how
smart/dumb I am, but I have seen enough to know that questions like
"Teach me about ++" ( and do my assignment) gets an even greater
vociferous response from the clc.

Anyway, thanks for your input and apologies that this was asked
twice, for which I have to point a finger at Google, which has
recently, once again been on the fritz ( which means there is most
definitely a * temporal* relationship between posting and seeing one's
message.

Jun 1 '07 #4
On 2007-05-31 19:29:30 -0700, mdh <md**@comcast.netsaid:
Given the expression:

while (isaspace(c = *s++))
x+1;
(s is an array)

Does the increment to 's' occur after "x+1" is evaluated, or after
the content of s is assigned to c? Is there a general rule as to when
this type of increment occurs? ( I understand that the increment in "c
= ++*s" occurs immediately before assignment, so my guess is the same
would apply in the "after" scenerio, but not sure).

thank you.
You already asked this 2 days ago. Go read the responses you got then.

--
Clark S. Cox III
cl*******@gmail.com

Jun 1 '07 #5
On 31 May 2007 19:29:30 -0700, mdh <md**@comcast.netwrote in
comp.lang.c:
Given the expression:

while (isaspace(c = *s++))
x+1;
(s is an array)

Does the increment to 's' occur after "x+1" is evaluated, or after
the content of s is assigned to c? Is there a general rule as to when
this type of increment occurs? ( I understand that the increment in "c
= ++*s" occurs immediately before assignment, so my guess is the same
would apply in the "after" scenerio, but not sure).

thank you.
Did you even read the answers you received to the same question two
days ago?

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Jun 1 '07 #6
mdh
thank you.

Did you even read the answers you received to the same question two
days ago?
Google...google...google.

Sorry...as I said, above, but not even sure if this is being sent
through, so I will repeat it..

....... apologies that this was asked
twice, for which I have to point a finger at Google, which has
recently, once again been on the fritz ( which means there is most
definitely a * temporal* relationship between posting and seeing
one's
message.

Jun 1 '07 #7
mdh wrote:
>
.... snip ...
>
Anyway, thanks for your input and apologies that this was asked
twice, for which I have to point a finger at Google, which has
recently, once again been on the fritz ( which means there is
most definitely a * temporal* relationship between posting and
seeing one's message.
So get rid of google and use a newsreader and server. Thunderbird
(from mozilla.com) meets the first, and if your ISP doesn't supply
a news server see below.

--
Some free news servers. I use teranews and gmane.
<http://www.teranews.com (1 time charge) (free)
<http://news.aioe.org (free)
<http://dotsrc.org (free)
<http://www.x-privat.org/international.php (free)
<http://motzarella.org/?language=en (free)
<http://gmane.org/ (mail-lists via news) (free)
<http://www.newsfeeds.com/signup.htm (pay)
<http://www.individual.net/ (low pay)

--
Posted via a free Usenet account from http://www.teranews.com

Jun 1 '07 #8
Clark Cox said:

<snip>
>
You already asked this 2 days ago. Go read the responses you got then.
Folks, we KNOW Google is on the blink again. Can we cut people a little
slack, please, until it's sorted out?

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Jun 1 '07 #9
On 2007-06-01 02:53:47 -0700, Richard Heathfield <rj*@see.sig.invalidsaid:
Clark Cox said:

<snip>
>>
You already asked this 2 days ago. Go read the responses you got then.

Folks, we KNOW Google is on the blink again. Can we cut people a little
slack, please, until it's sorted out?
All of the Google-induced repeats that I had seen up to this point were
separated in time by minutes and hours, not days.

--
Clark S. Cox III
cl*******@gmail.com

Jun 1 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: J. Campbell | last post by:
From reading this forum, it is my understanding that C++ doesn't require the compiler to keep code that does not manifest itself in any way to the user. For example, in the following: { for(int...
0
by: Jocel | last post by:
Greetings, You could waste months (and thousands of dollars) trying to figure out what really works on the Internet. Or you could save yourself the frustration, time and mistakes by following...
81
by: Matt | last post by:
I have 2 questions: 1. strlen returns an unsigned (size_t) quantity. Why is an unsigned value more approprate than a signed value? Why is unsighned value less appropriate? 2. Would there...
14
by: Chen Shusheng | last post by:
CSS white here: Simply strange, I found "define" can not work with "malloc". Together my complier will say "parse error". Could anyone tell me why? ------------------------- #define MAX 10000...
20
by: liujiaping | last post by:
I'm confused about the program below: int main(int argc, char* argv) { char str1 = "abc"; char str2 = "abc"; const char str3 = "abc"; const char str4 = "abc"; const char* str5 = "abc";
1
by: manchin2 | last post by:
Hi, Can anybody please provide the information about "&quot" and its use, if possible please provide an example. ...
0
by: Evan | last post by:
Hi, I'm a new hire with python program, I want to write script for changing/moniter/filter the network packet, it seems there are two extensions in python, pycap and pylibcap. I was confused,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.