Re: test if a string is a valid 'number'?
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Thu, 31 May 2007 09:23:12 -0400
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 itJoseph M. Newcomer [MVP]
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... :)
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- References:
- Re: test if a string is a valid 'number'?
- From: Ashot Geodakov
- Re: test if a string is a valid 'number'?
- From: Tom Serface
- Re: test if a string is a valid 'number'?
- From: Ashot Geodakov
- Re: test if a string is a valid 'number'?
- From: Joseph M . Newcomer
- Re: test if a string is a valid 'number'?
- From: Ashot Geodakov
- Re: test if a string is a valid 'number'?
- Prev by Date: Re: test if a string is a valid 'number'?
- Next by Date: Re: test if a string is a valid 'number'?
- Previous by thread: Re: test if a string is a valid 'number'?
- Next by thread: Re: test if a string is a valid 'number'?
- Index(es):
Relevant Pages
|