Is that true? I know the first part is true: sizeof(foo) or sizeof foo is evaluated at compile time, not run time. But "not invoked until run time" is also true for most operators, right? a + b is *generally* evaluated at run time.
I have a user-defined macro #define elementsof(a) sizeof(a)/sizeof(a[0]). Is that a function or an operator? It is certainly a "function-type macro." Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of Pew, Curtis G Sent: Monday, April 27, 2020 3:56 PM To: [email protected] Subject: Re: XL C\C ++ sizeof of datatypes On Apr 27, 2020, at 5:29 PM, Charles Mills <[email protected]> wrote: > > I guess it's an operator but it sure as heck looks like a function. > > If it walks like a duck and quacks like a duck ... > The distinction is that sizeof is calculated by the compiler during compilation. A function is not invoked until run time. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
