[Fixed] ACC does not support predecrement

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: [Fixed] ACC does not support predecrement

by HotWax » Mon Oct 20, 2003 10:25 pm

Ty Halderman wrote:Not really. My j=foo(...) was intended to represent complex and obscure logic, around which I placed my semi-bracketing pre/post inc/dec operations.

Okay, it was silly.
Yes, but mine accomplishes the same function without incurring the predecriment problem. :)

by Ty Halderman » Mon Oct 20, 2003 6:29 pm

Not really. My j=foo(...) was intended to represent complex and obscure logic, around which I placed my semi-bracketing pre/post inc/dec operations.

Okay, it was silly.

by HotWax » Sun Oct 19, 2003 10:40 pm

Ty Halderman wrote:Personal preference is to use pre or post at the beginning or end respectively of a block of code, anywhere that it really doesn't matter. Of course where there are side effects or more specific actions like in a for() statement, do what makes sense--this is just where it's otherwise completely immaterial which is used. (no, I didn't post-decrement "sense" or pre-decrement "this" in the sentence above :roll:

Code: Select all

++i;
j=foo(i+arg2);
j--;
Don't you mean

Code: Select all

j=foo(++i+arg2)-1;
?

by randi » Fri Oct 17, 2003 3:05 pm

Well, it will be fixed for ACC 1.31. ACC uses a different function for preoperators that aren't part of an assignment operation, and that function hadn't been updated to know about arrays.

by Ty Halderman » Thu Oct 16, 2003 11:06 pm

Personal preference is to use pre or post at the beginning or end respectively of a block of code, anywhere that it really doesn't matter. Of course where there are side effects or more specific actions like in a for() statement, do what makes sense--this is just where it's otherwise completely immaterial which is used. (no, I didn't post-decrement "sense" or pre-decrement "this" in the sentence above :roll:

Code: Select all

++i;
j=foo(i+arg2);
j--;

by Hirogen2 » Thu Oct 16, 2003 3:46 pm

Mannequin wrote:What's there to dislike with K&R? :shock:
Aside that their indent style does not match mine (to a specific degree) :P and that the book is not free like other C tutorials, if I think about it, nothing, it is like... anything else, no + no -.
And yeah, IIRC they used post-increment! :lol:

by Mannequin » Thu Oct 16, 2003 3:39 pm

Hirogen2 wrote:I dislike K&R (what of K&R anyway?) I cannot tell... some personal favor without a reason. Looks better!?
What's there to dislike with K&R? :shock:

I prefer the post-increment (decrement - whatever) operator better. I find I use it more, but not only that, I think it looks better than the pre-increment operator. :)

by Zell » Wed Oct 15, 2003 9:11 pm

HotWax wrote:
Destroyer wrote:
HotWax wrote:"make foo one less" looks even better. Shall we change the official command to that?
And while you do that, make a scripting language that uses plain english sentences("Raise the floor tagged 45 100 units at 10 eighth-units per tic.") rather than complicated commands("floor_raisebyvalue(45, 10, 100);").
Raise the whatty by the howdy? Tags? Units? That's confusing!!!

How about:

"Raise the floor over yonder by about half the height of my 6-year old daughter at the speed of my grandma in her old rocker."
XD

by HotWax » Wed Oct 15, 2003 9:08 pm

Destroyer wrote:
HotWax wrote:"make foo one less" looks even better. Shall we change the official command to that?
And while you do that, make a scripting language that uses plain english sentences("Raise the floor tagged 45 100 units at 10 eighth-units per tic.") rather than complicated commands("floor_raisebyvalue(45, 10, 100);").
Raise the whatty by the howdy? Tags? Units? That's confusing!!!

How about:

"Raise the floor over yonder by about half the height of my 6-year old daughter at the speed of my grandma in her old rocker."

by Kate » Wed Oct 15, 2003 5:41 pm

HotWax wrote:"make foo one less" looks even better. Shall we change the official command to that?
And while you do that, make a scripting language that uses plain english sentences("Raise the floor tagged 45 100 units at 10 eighth-units per tic.") rather than complicated commands("floor_raisebyvalue(45, 10, 100);").

by HotWax » Wed Oct 15, 2003 9:10 am

"make foo one less" looks even better. Shall we change the official command to that?

by Hirogen2 » Wed Oct 15, 2003 2:07 am

I dislike K&R (what of K&R anyway?) I cannot tell... some personal favor without a reason. Looks better!?

by Mannequin » Tue Oct 14, 2003 7:21 pm

Hirogen2 wrote:I like pre* more than post :)
Is that because of K&R? :wink:

by Hirogen2 » Tue Oct 14, 2003 11:42 am

I like pre* more than post :)

by randi » Tue Oct 14, 2003 11:36 am

It does not support predecrement of arrays if you try to use it as a stand-alone operator. (That is, you don't use the result of the operation in any way.) All that means is that you cannot do something like this:

Code: Select all

--foo[3];
But since that is completely equivalent to the following, I don't see this as much of a problem:

Code: Select all

foo[3]--;
The following works just fine:

Code: Select all

int a = --foo[3];
Note that this also applies to preincrement, and only to arrays.

Top