drh / lcc

The lcc retargetable ANSI C compiler

Home Page:https://drh.github.io/lcc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

supporting long long in 32-bit host

roytam1 opened this issue · comments

I'm getting error when compiling following code in ubuntu 10.04 LTS:

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>

int main() {
        struct stat b1, b2;
        stat("/bin",&b1);
        stat("/usr",&b2);

        if(b1.st_dev == b2.st_dev) {
                if(b1.st_ino == b2.st_ino) {
                        printf("/bin and /usr is same i-node\n");
                }
        }
        return 0;
}

and I got

stattest.c:10: operands of == have illegal types `__rlim64_t' and `__rlim64_t'

which typedefs as __u_quad_t which is "long long"(64-bit integer) type:

bits/types.h:typedef unsigned long int __u_quad_t;

There's no long long type in ANSI C, which is what LCC implements. If that's the problem you're having, you need a library and headers that are compatible with ANSI C.