Revert Linas' broken changes to qof.
linas at linas.org
Mon Apr 19 01:46:19 EDT 2004
On Sun, Apr 18, 2004 at 11:38:52PM -0400, Derek Atkins was heard to remark:
> linas at linas.org (Linas Vepstas) writes:
> >> Even worse, you were illegally calling functions of one argument with
> >> TWO arguments, and the compiler wasn't catching it due to the casting.
> >> This is BAD, and can lead to LOTS of problems down the road.
> > Its no worse than the function signature casting that is
> > already being done. The second argument is not clobbered
> > for the caller, because the callee linkage saves all clobbered
> > registers, and the callee couldn't care less, because it
> > saves and restores all registers that it clobbers. It's
> > perfectly safe; I've read the assembly umpteen times over
> > the years. Take a look at GTK signals, where this is done
> > all over the place; the added extra argument is usually
> > a gpointer to 'user-data'.
> It's ok so long as the _actual_ caller and _actual_ callee have the
> same number of arguments. What I'm doing NOW is perfectly safe in all
> cases because the calling argument is always a pointer (just pointers
> of different types), and the return value is just a register. Moreover,
Uhh, except for QOF_TYPE_DOUBLE which bombs because a double
doesn't fit into the default 32-bit return value. So we already
have a (far more serious) problem there, which we haven't seen
only because I don't think we use QOF_TYPE_DOUBLE anywhere.
Point being AccessFunc is already broke in a more serious way.
> You are effectively running this code:
I'm aware of what I did ...
> Which is black voodoo and NOT guaranteed to work. On some platforms
> foo() will see x, on some it will see y, and on some it may see total
I'm pretty sure it'll work on all systems and compilers.
The calling convention is determined by the ABI. I don't
beleive that there are any ABI's that exchange the order of
the args. And clobber semantics are also defined as part of
the ABI. Compilers must adhere to the ABI. So we are safe
just about everywhere.
> We're trying to write portable code, aren't we?
Yes. I guess that means that the only way to make you happy
would be to make *all* of the needed changes, and check it all in
concurrently? I'll do that.
> to s/390 or something.
Who's your daddy? Of course, the s/390 guys weren't very
freindly, now were they?
pub 1024D/01045933 2001-02-01 Linas Vepstas (Labas!) <linas at linas.org>
PGP Key fingerprint = 8305 2521 6000 0B5E 8984 3F54 64A9 9A82 0104 5933
More information about the gnucash-devel