If operand is a type (as opposed to variable name), the parentheses are required. If the operand is an expression (including a solitary variable name), the parentheses are optional.
> -----Original Message----- > From: IBM Mainframe Discussion List <[email protected]> On > Behalf Of Seymour J Metz > Sent: Monday, April 27, 2020 3:20 PM > To: [email protected] > Subject: Re: XL C\C ++ sizeof of datatypes > > I don't understand why, but after listing it as an operator K&R gives it as "sizeof (size > of an object)" and all of the examples have parentheses around the type. Of course, > something like "sizeof (struct tnode) " really does need the parentheses. > > -- > Shmuel (Seymour J.) Metz > http://mason.gmu.edu/~smetz3 > > > ________________________________________ > From: IBM Mainframe Discussion List <[email protected]> on behalf > of Farley, Peter x23353 <[email protected]> > Sent: Monday, April 27, 2020 1:30 PM > To: [email protected] > Subject: Re: XL C\C ++ sizeof of datatypes > > Joe, > > In C the "sizeof" keyword is an OPERATOR, not a function. Instead of > "sizeof(shorttype)" you should code "sizeof shorttype". > > Peter > > -----Original Message----- > From: IBM Mainframe Discussion List <[email protected]> On > Behalf Of Joseph Reichman > Sent: Sunday, April 26, 2020 9:58 AM > To: [email protected] > Subject: XL C\C ++ sizeof of datatypes > > HI > > I am looking in the XL C docs lang reference user guide programming guide > > For the length of the following data types > > Short , int long and I cannot seem to find it > > frustrated > > I coded a program > > Int len; > > Unsigned short shortype; > > Int len = sizeof(shorttype); > > But the compiler seemed to comment the above statement and not > generate the assembler ps (I am running metal c); > > Any help appreciate it > -- > > This message and any attachments are intended only for the use of the addressee and > may contain information that is privileged and confidential. If the reader of the > message is not the intended recipient or an authorized representative of the intended > recipient, you are hereby notified that any dissemination of this communication is > strictly prohibited. If you have received this communication in error, please notify us > immediately by e-mail and delete the message and any attachments from your system. > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
