open-watcom / open-watcom-v2

Open Watcom V2.0 - Source code repository, Wiki, Latest Binary build, Archived builds including all installers for download.
Other
985 stars 160 forks source link

an equivalent for __declspec(align(x)) or __attribute__((__aligned(x))) ? #374

Open sezero opened 7 years ago

sezero commented 7 years ago

Do we have an equivalent for __declspec(align(x)) or __attribute__((__aligned(x))) with watcom? E.g.: one might want to do:

  __declspec(align(32)) int ivar;
  static __declspec(align(32)) unsigned char arr[4096];
jmalak commented 7 years ago

it is not supported by Open Watcom. It requires support from code generator, run-time libraries and linker which is not implemented. OW use alignment value sizeof( int ).

sezero commented 7 years ago

Well, take this as a feature request, then :)

rgayoso commented 7 years ago

I do this: In C++ code: extern "C" aligned_struct buf; // Set in a special segment so assembler can set its alignment

pragma data_seg ( "ALIGNED_DATA" );

aligned_struct buf; // Set in standard segment name back again

pragma data_seg ();

In assembler code: ALIGNED_DATA segment PAGE4K public use32 'DATA' extrn _buf:aligned_struct ALIGNED_DATA ends