Re: "C" calling convention on x86

From: Dave Thompson (spamtrap_at_crayne.org)
Date: 09/20/04


Date: Mon, 20 Sep 2004 05:38:55 +0000 (UTC)

On Mon, 13 Sep 2004 11:10:03 +0000 (UTC), Mike <spamtrap@crayne.org>
wrote:

> >>- 4 byte floating point no's pushed onto stack as single DWORDs
> >>
> >
> > Except when dealing with variable-argument functions, here 4-byte
> > floating point values (real4, float, whatever) will be promoted to
> > 8-byte double (I believe this is standardized C behaviour, too lazy
> > to look it up in the reference though.)
> >
>
> Thank you, I hadn't even begun thinking about vararg calls yet :-)
>
> You mention "the reference". I spent quite a bit of time googling for an
> authoritative source on calling conventions and never really found
> anything. Who is the keeper of "the reference"?
>
As already said there is no single reference for calling conventions.

The C standard does provide that for varargs, and for unprototyped aka
old-style or K&R1 calls all args, values of integer types 'below' int
(char and short, both signed and unsigned forms, and bitfields) are
promoted to (signed) int -- or in some cases unsigned int, which are
required to be the same size and mostly though not completely the same
layout -- and 'float' is promoted to 'double'. Those aren't required
to be 4-byte and 8-byte specifically, but they are required to support
precision and range which in practice usually works out to that.

- David.Thompson1 at worldnet.att.net



Relevant Pages

  • Re: [PATCH] Make futex waiters take an mm or inode reference
    ... Make futex waiters take an mm or inode reference ... Rusty Russell wrote: ... +static inline void drop_key_refs ... -static int futex_wake ...
    (Linux-Kernel)
  • Re: dynamic type checking - a pauline conversion?
    ... it depends on the type of reference to the object. ... In Smalltalk the reference doesn't have a type but the instance does ... and C++ can not guarantee type correctness at compile ...
    (comp.object)
  • Re: Simplicity
    ... > ByRef (by reference) ... > Dim k as Zone ... property int Value; ... Microsoft C/C++ Optimizing Compiler Version 14.00.40809 ...
    (comp.lang.cpp)
  • Re: hash two keys to one index
    ... What goes into the map are pairs of (reference to key, ... When I insert an object into the hash table, I pass in ... void insert(Object obj, int hash) throws HashTableFull ... int probe = 0; ...
    (comp.lang.java.programmer)
  • Re: Assigning to references
    ... a reference ... behaves exactly like the object it refers to (it is an "alias" for that ... int a = 1; ... Bear in mind that, unlike a reference, a pointer will not extend the ...
    (comp.lang.cpp)