- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
I had read that Fortran 95 and later support an UNSIGNED data type for unsigned integers. I successfully compiled a small program with gfortran with this type, but Intel Fortran does not seem to recognize it. Does Intel Fortran support unsigned integer types?
Jay
- Balises:
- Intel® Fortran Compiler
Lien copié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
You may be thinking of the Oracle Fortran extension.
ISHFT and other bitwise intrinsics have effects of unsigned operations.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Is there a standard 1-byte type that represents integer quantities from 0 - 255? (This is admittedly more of a general Fortran question.)
Thanks,
Jay
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
jayb wrote:
Is there a standard 1-byte type that represents integer quantities from 0 - 255? (This is admittedly more of a general Fortran question.)
Not really. Most compilers for platforms which have hardware support for 1-byte integers have a (most likely) signed integer of that storage size (f2008 KIND=int8). This could relatively easily be used to represent 0-255 by expressions like AND(INT(i1,KIND(1)),255), since the default integer kind surely will support positive integers larger than that, as well as negative ones. Most usage would require it to be widened anyway, as there would be at most a limited repertoire of hardware instructions for unsigned byte size arithmetic.
Even more widespread would be a CHARACTER of the closest available to that size, which can be used as a default integer by ICHAR intrinsic, if you're willing to take chances on (or be careful about) what happens with unexpected collating sequences.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
The notion of an unsigned integer type, and also a bit type, has been extensively discussed amongst the Fortran standards committee. The majority of members voted to not add those to the language. There are bitwise functions - many commented that unsigned arithmetic led to many problems in C and they didn't want to introduce the same problems to Fortran.

- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable