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

David Chisnall csdavec at swan.ac.uk
Tue Dec 14 13:45:17 PST 2010


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



More information about the cfe-dev mailing list