sizeof()

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
PlayOS

sizeof()

Post by PlayOS »

Hi again,

Can anyone tell me how the sizeof() function works.

thanks.
dronkit

Re:sizeof()

Post by dronkit »

sizeof is not a function but an operator implemented directly by the
compiler itself, it doesn't belong to your program and is like a
reserved keyword.

At compile time each sizeof() is evaluated (accordingly) and then replaced
by its value.

The compiler knows the sizes of its data types, so it is trivial to translate the
data type to its type-size.
dronkit

Re:sizeof()

Post by dronkit »

This question doesn't belong here, either
PlayOS

Re:sizeof()

Post by PlayOS »

Sorry for posting here then, but I thought that it was part of libc, which is directly related to programming an OS based upon the C language. However if people think it to be off topic then I will not post anymore C questions here.

Sorry, and thanks for you answer anyway.
Post Reply