And that's why it works (but does not work without that cast), or as Gil put it "So I can't do "foo -> member", but must "(type *) foo-> member".
Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of Seymour J Metz Sent: Tuesday, February 25, 2020 9:34 AM To: [email protected] Subject: Re: Convert a Metal C control block mapping to Assembler DSECT ? 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 <[email protected]> on behalf of Charles Mills <[email protected]> Sent: Tuesday, February 25, 2020 12:26 PM To: [email protected] 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:[email protected]] On Behalf Of Paul Gilmartin Sent: Monday, February 24, 2020 5:35 PM To: [email protected] Subject: Re: Convert a Metal C control block mapping to Assembler DSECT ? On Tue, 25 Feb 2020 00:58:26 +0000, Seymour J Metz <[email protected]> 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 [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
