Question on /include/minix/const.h - Minix

This is a discussion on Question on /include/minix/const.h - Minix ; In include/minix/const.h there are a few lines defined as mode flags inodes, i.e #define I_BLOCK_SPECIAL 0060000 /* block special file */ #define I_DIRECTORY 0040000 /* file is a directory */ #define I_CHAR_SPECIAL 0020000 /* character special file */ Which are ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Question on /include/minix/const.h

  1. Question on /include/minix/const.h

    In include/minix/const.h there are a few lines defined as mode flags
    inodes, i.e

    #define I_BLOCK_SPECIAL 0060000 /* block special file */
    #define I_DIRECTORY 0040000 /* file is a directory */
    #define I_CHAR_SPECIAL 0020000 /* character special file */

    Which are supposedly set as bit flags in inode's i_mode of filesystems.

    What I don't quite understand are those octal integers. While trying to
    define my own using the same fomat:

    #define I_EXAMPLE 0080000

    cc barks out an error "Malformed octal integer constant", while 0x80000
    and 080000 compiles fine (albeit with unintended consequences )

    Can someone with a better grasp of C explain how is it cc accepts the
    original minix flags, but rejects mine?


  2. Re: Question on /include/minix/const.h

    Octal only uses digits [0-7]. It's no surprise the compiler will
    complain when you try to use an 8.

    zanglang@time.net.my wrote:
    > In include/minix/const.h there are a few lines defined as mode flags
    > inodes, i.e
    >
    > #define I_BLOCK_SPECIAL 0060000 /* block special file */
    > #define I_DIRECTORY 0040000 /* file is a directory */
    > #define I_CHAR_SPECIAL 0020000 /* character special file */
    >
    > Which are supposedly set as bit flags in inode's i_mode of filesystems.
    >
    > What I don't quite understand are those octal integers. While trying to
    > define my own using the same fomat:
    >
    > #define I_EXAMPLE 0080000
    >
    > cc barks out an error "Malformed octal integer constant", while 0x80000
    > and 080000 compiles fine (albeit with unintended consequences )
    >
    > Can someone with a better grasp of C explain how is it cc accepts the
    > original minix flags, but rejects mine?



  3. Re: Question on /include/minix/const.h

    Ah dang! I can't believe I would have missed that, thanks a lot. :P


    liquidicecube@gmail.com wrote:
    > Octal only uses digits [0-7]. It's no surprise the compiler will
    > complain when you try to use an 8.



+ Reply to Thread