Re: How can i emulate sizeof()



Eugeny Myunster wrote:

Hello all,
How can i emulate sizeof()
only for integers?

I'd really love to know which instructors keep giving this assignment.

Why do you want to "emulate sizeof", when sizeof exists just for this
purpose?

How about:

#define MySizeof(x) sizeof(x)

Now you can "emulate sizeof" by using "MySizeof(int)", for example.

--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:ThisIsASpamTrap@xxxxxxxxx>

.



Relevant Pages

  • Re: How can i emulate sizeof()
    ... Why do you want to "emulate sizeof", when sizeof exists just for this ... sizeof operator, but there's no point in using them; ... and speaking of homework assignments: ...
    (comp.lang.c)
  • Re: How can i emulate sizeof()
    ... How can i emulate sizeof() ... and goings and doings, seek always to be true to its teachings, and ...
    (comp.lang.c)
  • [PATCH] saner typechecking in generic unaligned.h
    ... Verify that types would match for assignment (under sizeof, so we are safe from ... side effects or any code actually getting generated), then explicitly cast ...
    (Linux-Kernel)