home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.os.vms      DEC's VAX* line of computers & VMS.      264,096 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 262,321 of 264,096   
   =?UTF-8?Q?Arne_Vajh=C3=B8j?= to Craig A. Berry   
   Re: basic BASIC question   
   01 Feb 25 19:04:43   
   
   From: arne@vajhoej.dk   
      
   On 2/1/2025 6:38 PM, Craig A. Berry wrote:   
   >   
   > On 2/1/25 3:00 PM, Arne Vajhøj wrote:   
   >> (in case someone wonder about C bool, then it is 8 bit!)   
   >   
   > I don't think it has to be.  C99 says:   
   >   
   > "An object declared as type _Bool is large enough to store the values 0   
   > and 1."   
   >   
   > 8 bits are enough, but any integral type has enough bits.  "bool,"   
   > "true," and "false" in stdbool.h are macros that can be overridden,   
   > although doing so is described as "obsolescent" behavior.  It's probably   
   > necessary because of the uses of bool before the standard had it.   
   >   
   > I'm pretty sure I've seen bool defined as an int on VMS, but whether   
   > that was something VAX C did for you or was just some what some program   
   > did in the absence of anything available from the (old) compiler I don't   
   > remember.   
      
   The C standard does not mandate 8 bit.   
      
   The VMS C documentation says 8 bit. Well - it says 1 byte   
   for whatever reason, but ...   
      
      
   3.2. Integral Types   
   In C, an integral type can declare:   
      
        Integer values, signed or unsigned   
      
        Boolean values, where 0 is equivalent to false and any nonzero   
   number is equivalent to true   
      
        Characters, which are automatically converted to an integer value   
   by the compiler   
      
        Members of an enumerated type, which are interpreted as an integer   
   by the compiler   
      
        Bit fields   
      
   The integral types are:   
      
        char, signed char, unsigned char – 8 bits   
      
        short int, signed short int, and unsigned short int – 16 bits   
      
        _Bool – 1 byte   
      
        int, signed int, unsigned int – 32 bits   
      
        long int, signed long int, and unsigned long int – 32 bits   
      
        signed long long int and unsigned long long int – 64 bits   
      
        signed __int64 and unsigned __int64 – 64 bits   
      
        enum – 32 bits   
      
      
   If one include stdbool.h then bool is _Bool. From C 99.   
      
   Before C 99 then I think:   
      
   typedef int bool;   
   #define TRUE 1   
   #define FALSE 0   
      
   was common.   
      
   (stdbool.h also defines true and false)   
      
   Arne   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca