Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"null pointer constant"?
#2
The term null pointer constant doesn't appear in the Glossary of the MISRA C Guidelines so its definition is the same as that used in The Standard. I suspect that the description used on p93 omitted the words "an integer constant expression with" for sake of brevity.

I think (void *)0.0f isn't a null pointer constant because it's neither in itself an integer constant expression, nor is it an integer constant expression cast to void *.

As an aside, since casts from arithmetic types to integer types are permitted to appear in integer constant expressions according to The Standard (C99 Section 6.6 para 6) and since floating point constants are explicitly permitted in integer constant expressions when used as operands of a cast (C99 Section 6.6 para 5), I think that (void*)(int)0.0f is a valid null pointer constant.
<t></t>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)