- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If I want to maintain a single set of source code for 32-bit and 64-bit builds, what is the best way to declare INTEGER variables that are automatically 4 bytes for 32-bit and 8 bytes for 64-bit? Should I use:
INTEGER (INT_PTR) MyInt
or
INTEGER (KIND=INT_PTR_KIND()) MyInt
or are they the same? Is there a better way to declare MyInt?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I like to use C_INTPTR_T from ISO_C_BINDING. It won't trigger standard conformance warnings.
This assumes that a pointer in C has the relevant bitness. In the segmented memory days things weren't always so straight forward.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page