Re: Cannot compile with _FILE_OFFSET_BITS = 64




"Scott.zhou" <rwxrxrx@xxxxxxxxx> wrote in message
news:fla6k1$j8h$1@xxxxxxxxxxxxxxxx
10 #define _FILE_OFFSET_BITS 64
11
12 int main(void) {
13 int fd;
14
15 if ((fd = open("file.hole", O_WRONLY | O_CREAT, 0664)) < 0) {
16 perror("open:");
17 exit(-1);
18 }
19
20 if (write(fd, "a", 1) != 1) {
21 perror("write:");
22 exit(-1);
23 }
24
25 if (lseek(fd, 4*1024*1024*1024, SEEK_SET) == -1) { // integer
overflow
No automatic conversion to 64 bit type is done by compiler. So make it
explicit by making one of the constants as 64 bit type. This makes entire
expression 64 bit.

=> 4*1024*1024*1024LL // 64 Bit constant made by LL suffix.


.



Relevant Pages

  • compile error about auto_ptr
    ... I am confused to read what the compiler says. ... int main ... available or copy constructor is declared 'explicit' ...
    (microsoft.public.dotnet.languages.vc)
  • compile error about auto_ptr
    ... I am confused to read what the compiler says. ... int main ... copy constructor is declared 'explicit' ...
    (microsoft.public.vc.language)
  • Re: Cannot compile with _FILE_OFFSET_BITS = 64
    ... No automatic conversion to 64 bit type is done by compiler. ... explicit by making one of the constants as 64 bit type. ... The very first multiplication is safe; but the second one might overflow, depending upon the value of INT_MAX. ...
    (comp.lang.c)
  • Re: It Pays to Enrich Your C Skills
    ... Check if you can score a perfect 10 (without using a compiler). ... int main{ ... struct bitfield { ... out if it is a negative integer constant or a constant expression ...
    (comp.lang.c.moderated)
  • OT: Re: Perl Peeves
    ... I see the result of a test being used as an int. ... the compiler just assumed you knew what you were doing ... introduced to the language later, so void * was unheard of in most code. ... This didn't mean bool was special, declaring it just signaled to the ...
    (comp.lang.perl.misc)