[cfe-dev] Modify for a variation of C with "size of" problem

Lu Mitnick king19880326 at gmail.com
Tue Dec 14 14:12:54 PST 2010


Because I want to support EFI C in clang. The main difference between ANSI C
and EFI C(used in EFI Byte Code Virtual Machine)

is that int size is determined at running time (4-byte on 32-bit processor
and 8-byte on 64-bit processor).

2010/12/15 David Chisnall <csdavec at swan.ac.uk>

> On 14 Dec 2010, at 21:18, Lu Mitnick wrote:
>
> > The main difference between
> >
> > the variation and the original one is that I wish to view the "size of"
> as a
> >
> > function.
>
> Before anyone can help you, I think that you need to explain what you are
> trying to do a bit more clearly.  In C, sizeof is not implemented as a
> function because it is impossible to implement it as a function.  Consider
> two typical uses:
>
> sizeof(int)
> sizeof(a)
>
> In the first case, it can't be a function because int is not a variable or
> constant and so can't be passed to a function.  In the second case, it could
> be a function call, but the function would not know the type of a and so
> would not be able to return something useful.
>
> So, when you say that you want sizeof to be viewed as a function, what do
> you actually mean?
>
> David
>
> -- Sent from my PDP-11
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101215/52e786b4/attachment.html>


More information about the cfe-dev mailing list