I am studying x86_64
assembler (yasm
) with this textbook. There I have met the following lines that define file access flags:
O_RDONLY equ 000000q
O_WRONLY equ 000001q
O_RDWR equ 000002q
The question is what do their values mean? What q
stands for?
In NASM/YASM it is a suffix that means the number is in Octal. From the documentation
3.5.1. Numeric Constants
A numeric constant is simply a number. NASM allows you to specify numbers in a variety of number bases, in a variety of ways: you can suffix H, Q or O, and B for hex, octal, and binary, or you can prefix 0x for hex in the style of C, or you can prefix $ for hex in the style of Borland Pascal. Note, though, that the $ prefix does double duty as a prefix on identifiers (see Section 3.1), so a hex number prefixed with a $ sign must have a digit after the $ rather than a letter.
Some examples:
mov ax,100 ; decimal mov ax,0a2h ; hex mov ax,$0a2 ; hex again: the 0 is required mov ax,0xa2 ; hex yet again mov ax,777q ; octal mov ax,777o ; octal again mov ax,10010011b ; binary