RE: vs 8 bug ?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



gordon wrote:
[...]
3) A quick review of the additional code posted in response to Ben's
request indicates that upon return from the call to "pApuUpdateHWclock"
the stack pointer is indeed restored to its pre-call value ... but, then
on the next call to function "_pApuFubar" the stack is not restored to its
pre-call value ...

4) Now, "_pApuFubar" is simply an alias for the same call to
"pApuUpdateHWclock" ... another name declared which executes the same call
...

5) the only difference between these two calls is the "_asm nop" present
after the first call to "pApuUpdateHWclock" ...

I'm not convinced yet. Have you considered what Alexander Grigoriev said?
Your code looked like this:

| __declspec( dllexport ) void APU_UpdateHWclock(double);
|
| // declared in the calling module
| typedef void (__cdecl *APU_UPDATE_HWCLOCK_FUNC)(double dT);
| APU_UPDATE_HWCLOCK_FUNC pApuUpdateHWclock ;

In one case, the __cdecl is present while in the declaration of
APU_UpdateHWclock() it isn't. Fix this first. If it doesn't help, create a
minimal example so we can try to reproduce it on our machines.

BTW: you can create function typedefs:

namespace apu {
typedef void __cdecl update_hwclock_function(double);
}

which have the same syntax as a declaration but prefixed with 'typedef' and
then create function pointers that look like pointers:

apu::update_hwclock_function* uhc = &APU_UpdateHWclock;

This doesn't change the technical side of this issue, but it makes things a
bit more readable. Just wanted to mention it.


6) finally, this is a very straight forward sequence of function calls,
nothing "tricky" going on at all ...

If you f*** up a function pointer cast you are in trouble. Getting it right
without any compiler-enforceable guide IMHO qualifies as "tricky".

Uli

.



Relevant Pages

  • Build regressions/improvements in v2.6.36-rc3
    ... declaration of function 'iowrite8': => 46 ... of 'memcpy' discards qualifiers from pointer target type: ... pointer types lacks a cast: ... dynamic stack allocation: => 392 ...
    (Linux-Kernel)
  • Build regressions/improvements in v2.6.36-rc2
    ... of 'memcpy' discards qualifiers from pointer target type: ... pointer from integer without a cast: ... fs/eventpoll.c: warning: 'pwq' may be used uninitialized in this ... or declaration, which is probably not what you want: ...
    (Linux-Kernel)
  • Re: including cray pointers in fortran modules
    ...  pointer (ipt, x) ... The first layer is with the declaration of ipt and that PROGRAM ... Cray pointer at has 4 bytes of precision; ...   ...
    (comp.lang.fortran)
  • on topic to clc [Was: Banks and economy]
    ... pointer type - which I think is correct for "arrays", ... Since, as a formal parameter, char cptr[]; ... pointer to the 'completing' declaration, ...   tentative definition. ...
    (comp.lang.c)
  • Re: [PATCH] x86, ioremap: use %pR in printk
    ... return string(buf, end, sym, field_width, precision, flags); ... %pF output the name of a function pointer ... %pR output the address range in a struct resource ... * function pointers are really function descriptors, ...
    (Linux-Kernel)