Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #86797 > unrolled thread
| Started by | Lynn McGuire <lynnmcguire5@gmail.com> |
|---|---|
| First post | 2022-10-04 20:41 -0500 |
| Last post | 2022-10-10 18:04 +0200 |
| Articles | 6 on this page of 26 — 8 participants |
Back to article view | Back to comp.lang.c++
how to specify an 8 byte bool ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-04 20:41 -0500
Re: how to specify an 8 byte bool ? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-10-04 19:58 -0700
Re: how to specify an 8 byte bool ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-04 22:35 -0500
Re: how to specify an 8 byte bool ? Christian Gollwitzer <auriocus@gmx.de> - 2022-10-05 07:38 +0200
Re: how to specify an 8 byte bool ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-05 14:02 -0500
Re: how to specify an 8 byte bool ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-05 14:03 -0500
Re: how to specify an 8 byte bool ? David Brown <david.brown@hesbynett.no> - 2022-10-05 09:38 +0200
Re: how to specify an 8 byte bool ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-05 14:03 -0500
Re: how to specify an 8 byte bool ? "Fred. Zwarts" <F.Zwarts@KVI.nl> - 2022-10-05 23:19 +0200
Re: how to specify an 8 byte bool ? "daniel...@gmail.com" <danielaparker@gmail.com> - 2022-10-05 18:45 -0700
Re: how to specify an 8 byte bool ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-05 21:05 -0500
Re: how to specify an 8 byte bool ? "daniel...@gmail.com" <danielaparker@gmail.com> - 2022-10-05 19:07 -0700
Re: how to specify an 8 byte bool ? "Fred. Zwarts" <F.Zwarts@KVI.nl> - 2022-10-06 10:39 +0200
Re: how to specify an 8 byte bool ? David Brown <david.brown@hesbynett.no> - 2022-10-06 14:14 +0200
Re: how to specify an 8 byte bool ? scott@slp53.sl.home (Scott Lurndal) - 2022-10-06 14:03 +0000
Re: how to specify an 8 byte bool ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-05 14:10 -0500
Re: how to specify an 8 byte bool ? scott@slp53.sl.home (Scott Lurndal) - 2022-10-05 20:34 +0000
Re: how to specify an 8 byte bool ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-05 16:18 -0500
Re: how to specify an 8 byte bool ? scott@slp53.sl.home (Scott Lurndal) - 2022-10-05 22:25 +0000
Re: how to specify an 8 byte bool ? scott@slp53.sl.home (Scott Lurndal) - 2022-10-05 22:27 +0000
Re: how to specify an 8 byte bool ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-05 19:16 -0500
Re: how to specify an 8 byte bool ? David Brown <david.brown@hesbynett.no> - 2022-10-06 14:16 +0200
Re: how to specify an 8 byte bool ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-06 15:07 -0500
Re: how to specify an 8 byte bool ? David Brown <david.brown@hesbynett.no> - 2022-10-07 09:07 +0200
Re: how to specify an 8 byte bool ? Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-07 14:23 -0500
Re: how to specify an 8 byte bool ? Bonita Montero <Bonita.Montero@gmail.com> - 2022-10-10 18:04 +0200
Page 2 of 2 — ← Prev page 1 [2]
| From | Lynn McGuire <lynnmcguire5@gmail.com> |
|---|---|
| Date | 2022-10-05 19:16 -0500 |
| Message-ID | <thl6or$33kmm$1@dont-email.me> |
| In reply to | #86812 |
On 10/5/2022 5:27 PM, Scott Lurndal wrote: > scott@slp53.sl.home (Scott Lurndal) writes: >> Lynn McGuire <lynnmcguire5@gmail.com> writes: >>> On 10/5/2022 3:34 PM, Scott Lurndal wrote: >>>> Lynn McGuire <lynnmcguire5@gmail.com> writes: >>>>> On 10/4/2022 8:41 PM, Lynn McGuire wrote: >>>>>> How do I specify an 8 byte bool ? Long long ? >>>>>> >>>>>> Thanks, >>>>>> Lynn >>>>> >>>>> I forgot to mention that this is how I handle the 8 byte logical*8 right >>>>> now: >>>>> >>>>> typedef long long logical8; >>>> >>>> Wouldn't it make more sense to convert to LOGICAL*4 or just LOGICAL and >>>> use a byte-width C++ bool instead? Seems silly to waste 63 bits. >>> >>> The indexes for the arrays are the same value for all four types of >>> arrays. So every array chunk has to be 64 bits whether it is double, >>> integer*8, character*8, or logical*8. >> >> Presumably the compiler will do the appropriate math using >> the index to calculate the memory byte(s) required. >> >> I don't understand your comment, unless you're using byte offsets >> intead of normal fortran indexing. > > Ah never mind, I see your aliasing the same storage four ways. Yup. Thanks, Lynn
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2022-10-06 14:16 +0200 |
| Message-ID | <thmgv1$3br22$2@dont-email.me> |
| In reply to | #86807 |
On 05/10/2022 21:10, Lynn McGuire wrote: > On 10/4/2022 8:41 PM, Lynn McGuire wrote: >> How do I specify an 8 byte bool ? Long long ? >> >> Thanks, >> Lynn > > I forgot to mention that this is how I handle the 8 byte logical*8 right > now: > > typedef long long logical8; > You should prefer the sized types here - int64_t or uint64_t. People can - and have - argue endlessly about the pros and cons of different types. But when you know you need a precise size, and anything else would be wrong, then it is best to specify that.
[toc] | [prev] | [next] | [standalone]
| From | Lynn McGuire <lynnmcguire5@gmail.com> |
|---|---|
| Date | 2022-10-06 15:07 -0500 |
| Message-ID | <thnciv$3ersc$1@dont-email.me> |
| In reply to | #86820 |
On 10/6/2022 7:16 AM, David Brown wrote:
> On 05/10/2022 21:10, Lynn McGuire wrote:
>> On 10/4/2022 8:41 PM, Lynn McGuire wrote:
>>> How do I specify an 8 byte bool ? Long long ?
>>>
>>> Thanks,
>>> Lynn
>>
>> I forgot to mention that this is how I handle the 8 byte logical*8
>> right now:
>>
>> typedef long long logical8;
>>
>
> You should prefer the sized types here - int64_t or uint64_t. People
> can - and have - argue endlessly about the pros and cons of different
> types. But when you know you need a precise size, and anything else
> would be wrong, then it is best to specify that.
Yeah, I have been thinking about changing f2c to use that. Since it
uses its own definitions in f2c.h, anything can be easily changed. f2c
is a fairly old software so it has dated types in it.
typedef long int integer;
typedef unsigned long int uinteger;
typedef char *address;
typedef short int shortint;
typedef float real;
typedef double doublereal;
typedef struct { real r, i; } complex;
typedef struct { doublereal r, i; } doublecomplex;
typedef long int logical;
typedef short int shortlogical;
typedef char logical1;
typedef char integer1;
typedef long long longint; /* system-dependent */
typedef long long logical8; /* system-dependent */
typedef unsigned long long ulongint; /* system-dependent */
#define fstring fem::str
Lynn
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2022-10-07 09:07 +0200 |
| Message-ID | <thoj89$3kcgp$1@dont-email.me> |
| In reply to | #86822 |
On 06/10/2022 22:07, Lynn McGuire wrote:
> On 10/6/2022 7:16 AM, David Brown wrote:
>> On 05/10/2022 21:10, Lynn McGuire wrote:
>>> On 10/4/2022 8:41 PM, Lynn McGuire wrote:
>>>> How do I specify an 8 byte bool ? Long long ?
>>>>
>>>> Thanks,
>>>> Lynn
>>>
>>> I forgot to mention that this is how I handle the 8 byte logical*8
>>> right now:
>>>
>>> typedef long long logical8;
>>>
>>
>> You should prefer the sized types here - int64_t or uint64_t. People
>> can - and have - argue endlessly about the pros and cons of different
>> types. But when you know you need a precise size, and anything else
>> would be wrong, then it is best to specify that.
>
> Yeah, I have been thinking about changing f2c to use that. Since it
> uses its own definitions in f2c.h, anything can be easily changed. f2c
> is a fairly old software so it has dated types in it.
>
> typedef long int integer;
> typedef unsigned long int uinteger;
> typedef char *address;
> typedef short int shortint;
> typedef float real;
> typedef double doublereal;
> typedef struct { real r, i; } complex;
> typedef struct { doublereal r, i; } doublecomplex;
> typedef long int logical;
> typedef short int shortlogical;
> typedef char logical1;
> typedef char integer1;
> typedef long long longint; /* system-dependent */
> typedef long long logical8; /* system-dependent */
> typedef unsigned long long ulongint; /* system-dependent */
> #define fstring fem::str
>
> Lynn
>
An alternative if you want to keep C90 support (well, C90 with "long
long" support) would be to include <limits.h> and add some compile-time
checks on the sizes. The point is to be sure that the sizes are what
you expect them to be.
You will also want to change the "logical1" and "integer1" typedefs. It
is madness to use a plain "char" for anything other than an ASCII
character. You want "signed char" for "integer1", and I would have
thought "unsigned char" is the appropriate choice for "logical1".
[toc] | [prev] | [next] | [standalone]
| From | Lynn McGuire <lynnmcguire5@gmail.com> |
|---|---|
| Date | 2022-10-07 14:23 -0500 |
| Message-ID | <thpub3$3q67u$1@dont-email.me> |
| In reply to | #86824 |
On 10/7/2022 2:07 AM, David Brown wrote:
> On 06/10/2022 22:07, Lynn McGuire wrote:
>> On 10/6/2022 7:16 AM, David Brown wrote:
>>> On 05/10/2022 21:10, Lynn McGuire wrote:
>>>> On 10/4/2022 8:41 PM, Lynn McGuire wrote:
>>>>> How do I specify an 8 byte bool ? Long long ?
>>>>>
>>>>> Thanks,
>>>>> Lynn
>>>>
>>>> I forgot to mention that this is how I handle the 8 byte logical*8
>>>> right now:
>>>>
>>>> typedef long long logical8;
>>>>
>>>
>>> You should prefer the sized types here - int64_t or uint64_t. People
>>> can - and have - argue endlessly about the pros and cons of different
>>> types. But when you know you need a precise size, and anything else
>>> would be wrong, then it is best to specify that.
>>
>> Yeah, I have been thinking about changing f2c to use that. Since it
>> uses its own definitions in f2c.h, anything can be easily changed.
>> f2c is a fairly old software so it has dated types in it.
>>
>> typedef long int integer;
>> typedef unsigned long int uinteger;
>> typedef char *address;
>> typedef short int shortint;
>> typedef float real;
>> typedef double doublereal;
>> typedef struct { real r, i; } complex;
>> typedef struct { doublereal r, i; } doublecomplex;
>> typedef long int logical;
>> typedef short int shortlogical;
>> typedef char logical1;
>> typedef char integer1;
>> typedef long long longint; /* system-dependent */
>> typedef long long logical8; /* system-dependent */
>> typedef unsigned long long ulongint; /* system-dependent */
>> #define fstring fem::str
>>
>> Lynn
>>
>
> An alternative if you want to keep C90 support (well, C90 with "long
> long" support) would be to include <limits.h> and add some compile-time
> checks on the sizes. The point is to be sure that the sizes are what
> you expect them to be.
>
> You will also want to change the "logical1" and "integer1" typedefs. It
> is madness to use a plain "char" for anything other than an ASCII
> character. You want "signed char" for "integer1", and I would have
> thought "unsigned char" is the appropriate choice for "logical1".
I don't use those types in my code so I don't care. Those types are
just in the standard f2c.h declaration.
Thanks,
Lynn
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2022-10-10 18:04 +0200 |
| Message-ID | <ti1fpo$remf$2@dont-email.me> |
| In reply to | #86797 |
Am 05.10.2022 um 03:41 schrieb Lynn McGuire: > How do I specify an 8 byte bool ? Long long ? If you use a long long you most times need a size_t on 64 bit platforms and a 32 bit size_t on 32 bit platforms. size_t'd bools might make sense to address two entities following each other in an array depending on the result of a boolean operation. Even this silly RISC-V-platform has an operation to load a zero or a one into a register depending on the result of a comparison (unfortunately that's the only predicated opera- tion that RISC-V has).
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.c++
csiph-web