hardcoded constants

T. William Wells bill at twwells.uucp
Thu Dec 22 12:18:48 AEST 1988


In article <1104 at goofy.megatest.UUCP> djones at megatest.UUCP (Dave Jones) writes:
: But if you don't like the naked "1", how about this?
:
: foo =  malloc( strlen(s) + strlen(t) + sizeof('\0'));
:
: Tells it all.  And keeps the reader on track, not grepping around
: for macros.

How about sizeof('\0') is equal to the size of an integer, which is
unlikely to be 1?

Remember, in C, character constants are integer constants.

---
Bill
{uunet|novavax}!proxftl!twwells!bill



More information about the Comp.lang.c mailing list