Fun with typedefs

Some might think this post belongs in a different forum because I am asking for help. But I thought that it might be inappropriate there, heck its probably inapropriate here for that matter. I thought it would be best to place it where there's not as much chance a student or someone will find it browsing for help with their homework. That being said I feel I should point out that anything I post here is very mild in comparison to just the name even of 'brainfuck', which is another issue all in itself.

So anyways... Why won't my code compile?

1
2
3
4
5
6
7
8
9
typedef unsigned Ive;
typedef long got, a;
typedef int big;

int main()
{
    Ive got a big dick;
    return 0;
}


I get the following error:
error: 'got' does not name a type.
'unsigned long int' is considered a single token. You can't do something like
1
2
3
4
5
typedef unsigned u;
typedef long l;
typedef int i;

u l i a;
You can do it with #define
Edit: Never mind I spotted the semi colon.

1
2
3
4
5
6
7
8
9
10
#define Ive unsigned
#define got long
#define a long
#define big int;
int main()
{
    Ive got a big dick;
    return 0;
}



line 7: error: redeclaration of c++ built in type 'long'
line 7: error: 'dick' was not declared in the scope.


however, if I leave everything as is but change line 7 to:

 
Ive got a dick;




It compiles fine.
Last edited on
ISO C++ doesn't support long long
Last edited on
Topic archived. No new replies allowed.