File tree Expand file tree Collapse file tree 2 files changed +10
-20
lines changed
Expand file tree Collapse file tree 2 files changed +10
-20
lines changed Original file line number Diff line number Diff line change 1-
2- /*
3- This code is from
4- The C Programming Language 2 edition, page 145
5-
6- There are two bugs int this original sample
7- - one memory leak
8- - one invalid state
9- */
10-
11- #pragma safety enable
12-
13- #define NULL ((void*)0)
14-
15- int i = as || NULL ;
1+ typedef long unsigned int uint64_t ;
2+ _Static_assert (sizeof (uint64_t ) == 8 , "" );
3+ int main (){}
Original file line number Diff line number Diff line change @@ -1870,11 +1870,7 @@ int type_get_sizeof(const struct type* p_type)
18701870 else if (p_type -> type_specifier_flags & TYPE_SPECIFIER_SHORT )
18711871 {
18721872 size = (int )sizeof (short );
1873- }
1874- else if (p_type -> type_specifier_flags & TYPE_SPECIFIER_INT )
1875- {
1876- size = (int )sizeof (int );
1877- }
1873+ }
18781874 else if (p_type -> type_specifier_flags & TYPE_SPECIFIER_ENUM )
18791875 {
18801876 //TODO enum type
@@ -1888,6 +1884,12 @@ int type_get_sizeof(const struct type* p_type)
18881884 {
18891885 size = (int )sizeof (long long );
18901886 }
1887+ else if (p_type -> type_specifier_flags & TYPE_SPECIFIER_INT )
1888+ {
1889+ //check long first!
1890+ //typedef long unsigned int uint64_t;
1891+ size = (int )sizeof (int );
1892+ }
18911893 else if (p_type -> type_specifier_flags & TYPE_SPECIFIER_INT64 )
18921894 {
18931895 size = (int )sizeof (long long );
You can’t perform that action at this time.
0 commit comments