Tried that great idea however I think you helped me uncover a bug in the
compiler
So it seems that a short is 2 bytes look below
However when I passed reclen as a parameter it was by value not by address
guess what the compiler did
L R14,@...RECLEN
ST R14,232(R13)
I would of thought it would be STH ?
* len = sizeof(reclen);
LA 15,2
ST 15,@111len
* return len;
NILH 15,X'0000'
NILH 15,X'0000'
BRU @1L38
-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of
John McKown
Sent: Sunday, April 26, 2020 11:33 AM
To: [email protected]
Subject: Re: XL C\C ++ sizeof of datatypes
On Sun, Apr 26, 2020 at 8:58 AM Joseph Reichman <[email protected]
<mailto:[email protected]> >
wrote:
> 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
>
I don't know about about Metal C, but if you use regular C with optimization,
and don't use a variable, the compiler simly won't generate any code to create
or initialize it. Perhaps you could use a program kike:
int main() {
unsigned short shorttype;
int len=sizeof(shorttype);
return len;
}
But, then again, you didn't show us the entire program.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions, send
> email to [email protected] <mailto:[email protected]> with the
> message: INFO IBM-MAIN
>
--
People in sleeping bags are the soft tacos of the bear world.
Maranatha! <><
John McKown
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to
[email protected] <mailto:[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