hello,
for NXC: what are the differences between strlen vs. StrLen ?
Re: NXC: strlen vs. StrLen
Posted: 24 Jul 2011, 17:31
by spillerrec
AFAIK, StrLen was renamed into strlen so that it correspond to the C function. StrLen still exists for backwards-compatibility. There is a couple of functions that are like that, however some might be macro versions, while others aren't iirc.
Anyway, both functions both uses ArrLen and then subtract one, no matter where NULL actually is...
Re: NXC: strlen vs. StrLen
Posted: 25 Jul 2011, 09:08
by timpattinson
2/07 test release, level 2 optimization.
StrLen():
I would not prejudge your evaluation now - but at first glance, it looks as if strlen code is shorter...
any other significant differences?
Re: NXC: strlen vs. StrLen
Posted: 25 Jul 2011, 10:21
by timpattinson
I don't know, it appears smaller and faster, but i'm a n00b at reading asm
It also appears the call has been omitted from the version using strlen()
Re: NXC: strlen vs. StrLen
Posted: 25 Jul 2011, 13:46
by spillerrec
Please be aware that the optimizer might remove unneeded code and this is why the second program is smaller, it is simply empty...
Remember to use TextOut/NumOut or at least something to make sure the calculated values are actually used. (It is interesting that only one of the functions disappear though.)
Re: NXC: strlen vs. StrLen
Posted: 25 Jul 2011, 20:48
by afanofosc
Here's the code without it being removed by the optimizer: