In the distant past I used the GnuCOBOL binary-long to represent a C code int. Recently reading the great GnuCOBOL docs late at night, I came across a table that used binary-short. I thought 'Oh well' and tried it on a very superficial test and it worked ok. In the light of day a binary-long still looks right to my 64 bit mind. Looking into other things today, I found the binary-int in use in some sample code and thought that would be the best representation to use.
I realize this stuff has been evolving over the almost 10 years that I have been away and that I should take care to use the language correctly. Is binary-int the better choice?
Thanks,
Gerald.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
binary-short is a 16-bit integer, and possibly not what you look for
binary-long is a 32-bit integer; binary-int is identical, but an extension so I'd rather not use it (and if you then get to a compiler that does not understand the standard version either make it an alias or use a global REPLACE command)
binary-double is a 64-bit integer
If you ever CALL into C space you should use whatever the C functions want, with taking the machine / architecture / c-library into account.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you look at the PG (Programmer Guide) manual at section 6.8.1 for a list of all with their byte sizes at the end of this section and at 6.9.49 for USAGE BINARY for all of the differenrt types and their max values for signed and unsigned values it might help you.
There are other sources for development notes which I must get around to put them all together as GC Programmer Briefs / Notes .
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi everyone,
In the distant past I used the GnuCOBOL binary-long to represent a C code int. Recently reading the great GnuCOBOL docs late at night, I came across a table that used binary-short. I thought 'Oh well' and tried it on a very superficial test and it worked ok. In the light of day a binary-long still looks right to my 64 bit mind. Looking into other things today, I found the binary-int in use in some sample code and thought that would be the best representation to use.
I realize this stuff has been evolving over the almost 10 years that I have been away and that I should take care to use the language correctly. Is binary-int the better choice?
Thanks,
Gerald.
That completely depends on what you want.
binary-short
is a 16-bit integer, and possibly not what you look forbinary-long
is a 32-bit integer;binary-int
is identical, but an extension so I'd rather not use it (and if you then get to a compiler that does not understand the standard version either make it an alias or use a globalREPLACE
command)binary-double
is a 64-bit integerIf you ever
CALL
into C space you should use whatever the C functions want, with taking the machine / architecture / c-library into account.Thank you Simon.
If you look at the PG (Programmer Guide) manual at section 6.8.1 for a list of all with their byte sizes at the end of this section and at 6.9.49 for USAGE BINARY for all of the differenrt types and their max values for signed and unsigned values it might help you.
There are other sources for development notes which I must get around to put them all together as GC Programmer Briefs / Notes .