Told ya :)
The beer is strong in us tonight :P
Haha :)

I did the testing ~9 hours ago, after just getting out of bed from a nap before work (suffered from insomnia last night, once again) - pretty brainfscked and in a slight hurry to get to work in time, I obviously didn't check the results properly (shame on me). I've edited my previous posts to remove the bug-accusations (well, striked them out so you can still see how silly I was :)). Let's see some feedback from Homer...

PS: I hope you use lengthof and not sizeof for the cchWideChar argument in your production code :P

The whole world would collapse if that func was buggy in that way.
Probably would (there's too many people who haven't left nul-terminated strings yet) - which is why I was considering this to be a pretty serious bug :)
Posted on 2009-09-08 19:01:21 by f0dder
Ugh... that's pretty bad coding practice. When the compiler tells you there's an issue, there's usually a reason for it (C++ and the PlatformSDK is painful, though - less so in C mode). But doing this as a general coding practice is bad.


Lol, I've never been accused of writing clean/legible code. :P (nor would I try to admit to it). It honestly started with stupid functions like malloc that try to be type-independent through the use of void* but yet the compiler I was using at the time would complain if you didn't typecast. I just got so tired of those things popping up that I just started typecasting everything. lol

You might want to move to a decent compiler, or at least a more recent version of GCC? With VC2008 (and also lot older versions, I expect) introducing the temporary variable results in exactly the same code as doing the one-liner.


I'll run an update of GCC later and see if it's any better. You are actually probably right on this behalf as most of my software on this box is source builds and it's a bit difficult to keep everything updated. I should probably install apt-get or gdebi one of these days to ease the burden of updating. You should see my /usr/share/nasm/src folder XD

bkeller@assembly.ath.cx ~
$ ls /usr/share/nasm/src/
nasm-0.99.05.tar.gz  nasm-2.04rc1.tar.gz   nasm-2.06rc15.tar.gz
nasm-0.99.06.tar.gz  nasm-2.04rc2.tar.gz   nasm-2.06rc16.tar.gz
nasm-2.00rc1.tar.gz  nasm-2.04rc3.tar.gz   nasm-2.06rc1.tar.gz
nasm-2.00rc2.tar.gz  nasm-2.04rc4.tar.gz   nasm-2.06rc2.tar.gz
nasm-2.00rc3.tar.gz  nasm-2.04rc5.tar.gz   nasm-2.06rc3.tar.gz
nasm-2.00.tar.gz     nasm-2.04rc6.tar.gz   nasm-2.06rc4.tar.gz
nasm-2.01rc1.tar.gz  nasm-2.04.tar.gz      nasm-2.06rc5.tar.gz
nasm-2.01rc2.tar.gz  nasm-2.05.01.tar.gz   nasm-2.06rc6.tar.gz
nasm-2.01.tar.gz     nasm-2.05rc1.tar.gz   nasm-2.06rc7.tar.gz
nasm-2.02rc1.tar.gz  nasm-2.05rc2.tar.gz   nasm-2.06rc8.tar.gz
nasm-2.02rc2.tar.gz  nasm-2.05rc3.tar.gz   nasm-2.06rc9.tar.gz
nasm-2.02.tar.gz     nasm-2.05rc4.tar.gz   nasm-2.06.tar.gz
nasm-2.03.01.tar.gz  nasm-2.05rc5.tar.gz   nasm-2.07rc1.tar.gz
nasm-2.03rc1.tar.gz  nasm-2.05rc6.tar.gz   nasm-2.07rc2.tar.gz
nasm-2.03rc2.tar.gz  nasm-2.05rc7.tar.gz   nasm-2.07rc3.tar.gz
nasm-2.03rc3.tar.gz  nasm-2.05rc8.tar.gz   nasm-2.07rc4.tar.gz
nasm-2.03rc4.tar.gz  nasm-2.05.tar.gz      nasm-2.07rc5.tar.gz
nasm-2.03rc5.tar.gz  nasm-2.06rc10.tar.gz  nasm-2.07rc6.tar.gz
nasm-2.03rc6.tar.gz  nasm-2.06rc11.tar.gz  nasm-2.07rc7.tar.gz
nasm-2.03rc7.tar.gz  nasm-2.06rc12.tar.gz  nasm-2.07.tar.gz
nasm-2.03rc8.tar.gz  nasm-2.06rc13.tar.gz
nasm-2.03.tar.gz     nasm-2.06rc14.tar.gz


:| . o O ( speaking of which I should find out what the latest version is.... )
Posted on 2009-09-08 19:07:54 by Synfire

PS: I hope you use lengthof and not sizeof for the cchWideChar argument in your production code :P


The code is:

z2 dw 40 dup (0CCCCh) ; 40 words
...
invoke MultiByteToWideChar,CP_ACP,0,addr z1,-1,addr z2,40;
"cchWideChar - Specifies the size, in wide characters,"

No prob there either :P
Posted on 2009-09-08 19:08:09 by Ultrano