The struc type covers a multitude of sins. I would consider C++ to more secure 
unless you use the stuff that is only in the language for C compatibility.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


________________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of 
Adam Jacobvitz <000002b29b762ea6-dmarc-requ...@listserv.ua.edu>
Sent: Tuesday, February 25, 2020 1:08 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Convert a Metal C control block mapping to Assembler DSECT ?

i learned in CS class that static type casting is reliable in C since there are 
only 3 types (struct int float) that matter but unreliable in C++ due to the 
more sophisticated type system that allows for multiple inheritance.

So wouldn’t it be better to infer the type from the assembly macro (compare it 
to the stdlib implementation)? If it’s compiled it should be similar even if 
it’s not the same due to hoist style optimizations.

On Tue, Feb 25, 2020 at 9:34 AM, Seymour J Metz <sme...@gmu.edu> wrote:

> Paul's "(type *) foo-> member" uses a cast, so he *has* specified what type 
> foo points to.
>
> --
> Shmuel (Seymour J.) Metz
> http://mason.gmu.edu/~smetz3
>
> ________________________________________
> From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of 
> Charles Mills <charl...@mcn.org>
> Sent: Tuesday, February 25, 2020 12:26 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: Convert a Metal C control block mapping to Assembler DSECT ?
>
> Huh? Void * specifically says "foo points to something but I won't say what" 
> so no, you can't reference members of something you have not specified. It is 
> equivalent to assembler FOO DS A. A of what? Who knows.
>
> If you say myStruct * foo then yes you can say foo->myStructMember. Or you 
> can say "at this moment foo points to myStruct and code (myStruct 
> *)foo->myStructMember
>
> Continuing the assembler analogy, myStruct * foo is roughly equivalent to 
> assembler L Rn,FOO/USING MYSTRUCT,Rn .
>
> Assembler is a terrible starting point, except considering what the problem 
> was. The problem was "we have a bunch of new C development and lots of tables 
> already defined in assembler." So the correct tool is an assembler to C 
> converter. By starting from the SYSADATA output as EDCDSECT does, you leave 
> messy problems like line continuation, syntax errors and macro expansion to 
> the assembler.
>
>> How can you generate the type in the declarator?
>
> EDCDSECT cannot. Generates lots of void *'s. Not the best approach, but it is 
> the best tool we have for user DSECT to C header conversion (not counting 
> Peter's tool, which is not available for user DSECTs). One is free to go back 
> and edit the void *'s.
>
> Charles
>
> -----Original Message-----
> From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On 
> Behalf Of Paul Gilmartin
> Sent: Monday, February 24, 2020 5:35 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: Convert a Metal C control block mapping to Assembler DSECT ?
>
> On Tue, 25 Feb 2020 00:58:26 +0000, Seymour J Metz <sme...@gmu.edu> wrote:
>
>>FSVO typed.
>>
>>void * foo
>>
> So I can't do "foo -> member", but must "(type *) foo-> member". Ugh!
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to