Which systems use an uneven representation of a pointer?

Possible duplicate:
Are there any platforms where pointers to different types have different sizes?

I read in several places that pointers of different types can have different representations in standard compatible implementations of C. This is one thing that makes printf pointer arguments necessary, for example.

int foo;
printf("address is %p\n", (void *) &foo);

I was skeptical about this and poked through the C99 standard (document WG14 N1256, available at http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf ). In paragraph 6.2.5.27, it reads:

A pointer to a void must have the same presentation and alignment requirements as a pointer to a character type. Similarly, pointers to qualified or unqualified versions of compatible types must have the same presentation and alignment requirements. All pointers to structure types must have the same presentation and alignment requirements as each other. All pointers to types of trade unions should have the same presentation and harmonization of requirements with each other. Pointers to other types need not have the same presentation or alignment requirements.

So, it really sounds like the corresponding C99 implementation can use different views for pointers of different types.

: / C, ?

+3
2

Cray ( ) , char* , , void* .

(. ). , ABI, , , "" "" .)

+4

, x86, 16- 32- ( 32- 16- - ...).

+4

Source: https://habr.com/ru/post/1767996/


All Articles