| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: Auto string-length determinatio |
-=> Quoting Paul Edwards to Paul Wankadia <=- Hello Paul, PE> ISO 6.3.3.4 PE> The sizeof operator yields the size (in bytes) of its operand, which may be PE> an expression or the parenthesized name of a type. PE> They give examples... PE> sizeof *dp PE> sizeof array / sizeof array[0] PE> Now, as far as I am aware, an "expression" would include putting PE> the variable in parentheses, e.g. x and (x) should both be PE> valid expressions. Is there are circumstance where x would PE> work, but (x) wouldn't? Not that comes to mind. AFAIK, if x is a variable, (x) always evaluates to x. PE> What about the reverse? Might putting x in parentheses be PE> better, to make sure that you know which expression the sizeof PE> is being done against? Possibly. That's why I usually do it, but I try to do it like: sizeof (x) sizeof (int) so that it doesn't look like a function call. When people refer to the sizeof operator as a function it disturbs me almost as badly as when they refer to the return statement as a function. :) PE> If I come to a situation where it is potentially ambiguous, I PE> might experiment. Until then, for the simple cases, I'll just PE> do as they said above. At least for the same reason that I PE> don't go x = (y) * (4). Fair enough. Michael Stapleton of Graphic Bits. * AmyBW v2.10 * ... This tagline is encrypted --- AdeptXBBS v1.07f (Registered)* Origin: Mach One BBS (3:713/615) SEEN-BY: 50/99 620/243 623/630 626/664 711/409 410 413 430 808 809 932 934 SEEN-BY: 712/515 713/111 317 601 611 615 618 700 826 906 914 714/906 800/1 @PATH: 713/317 711/808 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.