[chuck-users] ++ return value
nitro2k01 at gmail.com
Wed Jun 28 09:14:52 EDT 2006
> That being said; out of pure curiocity, would "now++;" compile?
Wild guess: No, I think now (as well as other time expressions) are
objects and not numbers. Also, such expression would not be very
useful, since it's ambiguous depending on sample rate. (Or is the unit
of now independent of the sample rate?)
> Wow, you like to live on the edge! :)
Maybe a bad example, I just wrote down the first thing that crossed
my mind. But still that's most probably the way I'd write that piece
of code in a real situation.
> Unless I'm vastly mistaken, the code is compiled into exactly the same
> assembly commands as
> In other words, there's no computational benefit to writing that as a
> single statement.
I haven't yet looked into the kernel of ChucK, but that's possible.
But depending on the CPU architecture (Including both virtual and
physical machines) and the effectiveness of the compiler having a
statement with a unary operator will make sense from a computational
point of view. On the other hand most C compilers have good
optimization egines and don't need the statements to be nested by a
-----BEGIN 2ROT13 MESSAGE-----
The blog of nitro2k01: <http://soundandcomplete.wordpress.com/>
Sätt på ett par flipflops, vippa på rumpan
och gör det här till en minnesvärd sommar!
-----END 2ROT13 MESSAGE-----
More information about the chuck-users