Re: test if a string is a valid 'number'?



There is very little assembly code in the Windows sources. Even in the C library, only
the most important inner loops have been optimized in assembly code, and every one of
these has a non-optimal solution written in pure C.

Microsoft claims that there are about 15,000 lines of assembly code in the millions of
lines of WIndows code. It is to be used when either there is no alternative to using it
(e.g., low-level hardware interfacing to interrupts and such) or you can write something
that is significantly faster and which matters. In this case, you can write it in pure C
code without assembler, and performance is not an issue. So why do you have it? It can't
be argued that it is necessary because the call is already supported in the language,
without assembly code. It can't be argued that efficiency is the issue, because loading a
DLL swamps the cost of the call by several orders of magnitude. So why is it there at
all?

I noticed, by the way, that your declaration of the function pointer is incorrect; given
that erroneous declaration, the pure-C call might fail, but if you declare the function
pointer CORRECTLY, then you don't need the assembly code!

It should have been

typedef long (__stdcall * ISNUMERIC )( VARIANT* );

so your "need" for assembly code is merely the result of a failure to understand
__stdcall, which is not really excusable if you are a Windows programmer.

It won't compiler in Win64 because the Win64 compiler does not support the _asm directive!
It won't run in Win64 because you can't call 32-bit DLLs from Win64 apps.

And what happens when that particular VB DLL is no longer supported?
joe


On Wed, 30 May 2007 22:11:45 -0700, "Ashot Geodakov" <a_geodakov@xxxxxxxxxxxxxxxxxx>
wrote:

Sure it won't compile in GCC on Unix, but did you actually try compiling it
on Win64?

And seriously, what is 'bulletproof' in this world? Even Windows' sources
are full of assembly code.

"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
news:gles53d38iaqrn0u6gn47j08hd0vpguahf@xxxxxxxxxx
Hmm. Bulletproof? It won't run on any of my machines, and it won't
compile for a 64-bit
platform. That doesn't strike me as being "bulletproof".
joe

On Wed, 30 May 2007 16:10:33 -0700, "Ashot Geodakov"
<a_geodakov@xxxxxxxxxxxxxxxxxx>
wrote:

Actually, I meant this sample as a pure joke (but I triple-checked that
it's
bullet-proof). But then I felt compelled to defend it after being
attacked... :)



Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: edit box population in a dialog box
    ... A desire to learn assembly code is one thing, but trying to justify assembly code as being ... Windows doesn't have the equivalent of ksh. ... There are few programming languages ... more horrific, badly-designed, and destructively idiosyncratic than the various Unix shell ...
    (microsoft.public.win32.programmer.gdi)
  • Re: how to turn off NX bit in assembly?
    ... I want to turn off AMD64 NX bit in assembly code(at&t syntax or gcc ... inline code). ... I don't think the OS (Windows and Linux) would allow you to mess ... under Linux you'd call mprotectwith the appropriate ...
    (alt.lang.asm)
  • Re: Problems on debugging ARM assembly code
    ... Book Author - XP Embedded Advanced, XP Embedded Supplemental Toolkit ... I am working on a project for Windows Mobile 5 and I really need to optimise a function using assembly language for ARM. ... I wrote an .asm file where I placed the assembly code for my function. ... I managed to debug my assembly code using "Disassembly" window. ...
    (microsoft.public.windowsxp.embedded)
  • Re: how to turn off NX bit in assembly?
    ... I want to turn off AMD64 NX bit in assembly code(at&t syntax or gcc ... inline code). ... I don't think the OS (Windows and Linux) would allow you to mess ...
    (alt.lang.asm)
  • Re: test if a string is a valid number?
    ... it on Win64? ... what is 'bulletproof' in this world? ... Even Windows' sources ... are full of assembly code. ...
    (microsoft.public.vc.mfc)

Quantcast