structured assembler (BASIC) [R

Davidsen davidsen at steinmetz.UUCP
Fri May 2 07:20:11 AEST 1986


In article <1700007 at umn-cs.UUCP> herndon at umn-cs.UUCP writes:
>
>  I disagree.  Sizeof is definitely NOT a function.  It is a builtin
>of the C language, but it is not and could not be written as a function
>(well...), just as return is definitely not a function.

Actually sizeof is a unary operator. It applies to the following object, when
object is defined as:
	a variable name
	a variable type (including all struct and pointer types)
	the object of indirection of a pointer type

Examples:
  int ka, kb[10], *kc;
  struct foo sa, *sb;

All the same (part 1):
  sizeof int
  sizeof (int)
  sizeof ka
  sizeof (ka)
  sizeof *kc
  sizeof (*kc)
(however, sizeof kb == 10*sizeof int)

All the same (part 2):
  sizeof struct foo
  sizeof (struct foo)
  sizeof sa
  sizeof (sa)
  sizeof *sb
  sizeof (*sb)
-- 
	-bill davidsen

	seismo!rochester!steinmetz!--\
       /                               \
ihnp4!              unirot ------------->---> crdos1!davidsen
       \                               /
        chinet! ---------------------/        (davidsen at ge-crd.ARPA)

"Stupidity, like virtue, is its own reward"



More information about the Comp.lang.c mailing list