Page 1 of 2

ACC doesnot support predecrement

Posted: Tue Oct 14, 2003 3:10 am
by Hirogen2
Hi,

just noted that ACC does not handle pre-decrement, à la --some_array. Whether this holds true for single variables like --x too, I did not check.

Posted: Tue Oct 14, 2003 5:42 am
by Graf Zahl
Who cares?

Posted: Tue Oct 14, 2003 9:16 am
by HotWax
ACC is not as robust as C, and wasn't designed to be. The prefixed decrament is easily gotten around, anyway.

Posted: Tue Oct 14, 2003 11:34 am
by Hirogen2
That's essential! :)
Changed Topic: Pre-Decrement and Pre-Increment do not work when applied to array members.

Posted: Tue Oct 14, 2003 11:36 am
by randi
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.

Posted: Tue Oct 14, 2003 11:42 am
by Hirogen2
I like pre* more than post :)

Posted: Tue Oct 14, 2003 7:21 pm
by Mannequin
Hirogen2 wrote:I like pre* more than post :)
Is that because of K&R? :wink:

Posted: Wed Oct 15, 2003 2:07 am
by Hirogen2
I dislike K&R (what of K&R anyway?) I cannot tell... some personal favor without a reason. Looks better!?

Posted: Wed Oct 15, 2003 9:10 am
by HotWax
"make foo one less" looks even better. Shall we change the official command to that?

Posted: Wed Oct 15, 2003 5:41 pm
by Kate
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);").

Posted: Wed Oct 15, 2003 9:08 pm
by HotWax
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."

Posted: Wed Oct 15, 2003 9:11 pm
by Zell
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

Posted: Thu Oct 16, 2003 3:39 pm
by Mannequin
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. :)

Posted: Thu Oct 16, 2003 3:46 pm
by Hirogen2
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:

Posted: Thu Oct 16, 2003 11:06 pm
by Ty Halderman
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--;