Dave Vandervies wrote:
Unless it's been changed between N869 and C99, the behavior for a null
pointer given to assert isn't explicitly defined; it defines an action
on a scalar value it's given without mentioning pointers at all.
Are you aware that pointer types are scalar types?
Your statement makes me think that you are not.
There are three major categories of types:
1 function types
2 incomplete types
3 object types
Old style function types are according to the return type
of the function. Modern function types also include the parameter
types. The only two things that can be done with the value
of an expression of a function type,
is that it can be converted to a pointer to a function of that type,
or it can be the operand of unary & operator, which returns a pointer.
In the expression
puts("Hello")
puts is converted to a pointer.
In the expression
(&puts)("Hello")
puts is not converted. The result of the & operator is a pointer
and that result is not converted by the function call.
The sizeof and unary & operators
never cause conversion of their operands.
In the expression
(*puts)("Hello")
puts is converted by the unary * operator to a pointer.
The result of the operation is an expression of a function type
and is converted to an expression of pointer type by
the function-call operator ().
The only two incomplete types that I'm aware of are
void
and ones of the form
array[]
sizeof is not defined for expressions with incomplete types.
Expressions of type void have no values.
The only three things that you can do with the value of
an array of unknown size is:
1 convert it to a pointer to it's first element
2 initialize it and convert it to an array of some specified size
3 it can an be the operand of unary &
Object types, in addition to objects, also apply to:
constant expressions,
5
indeterminate expressions,
array[-1]
and rvalues.
(a + b)
There are three major catagories of object types:
1 scalar types
2 agregate types
3 unions
There are two kinds of scalar types:
arithmetic types and pointer types.
The unary * operator is only defined for pointer types.
There are two kinds of arithmetic types:
floating types and integer types.
Bitwise operators are not defined for any types except integer types.
There are two kinds of aggregate types:
1 arrays
2 stuctures
The assignment operator is defined for expressions of structure type.
Structure members of array type, are byte copied when
the structure containing them is the right operand
of the assignment operator.
The equality and relational operators are not defined
for expressions of structure type.
The value of an expression of array type can be:
1 the operand of unary &
2 converted to a pointer to it's first element
3 used as an initializer
4 copied bytewise when it is a member of a structure which
is a right operand of the assignment operator.
And that's all that I have to say about types for now.