News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

ML with /Zp8

Started by GM, February 09, 2005, 09:00:59 AM

Previous topic - Next topic

GM

Hi,

is it possible to set the parameter /Zp8 with ML.

this is from MSDN C/C++ Preprocessor Reference   

pack
QuoteSpecifies packing alignment for structure, union, and class members. pack gives control at the data-declaration level. This differs from compiler option /Zp, which only provides module-level control. pack takes effect at the first struct, union, or class declaration after the pragma is seen; pack has no effect on definitions. Calling pack with no arguments sets n to its default value. This is equivalent to compiler option /Zp8.


Greetings to all
GM

hutch--

i doubt it unless it is published for NL.EXE and not just CL.EXE. To use structures and unions in ML.EXE you must have them predefined and with MASM you can align structures with no problems. If you could tell us a bit more of what your after, perhaps we could help you.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

GM

OK, the default alignment in "Visual Studio 6.0" is 8.
I thought I could use Zp8 to get the same global structure alignment with MASM.
But I think I have to set the alignment in each struc separately i.e "MyStruc STRUCT 8"

Thank you anyway.


P1

use "Align 8" in your .data section or code will accomplish the same thing.

Regards,  P1  :8)

Syntax:   ALIGN [number]

  Description:

     ALIGN aligns the next variable or instruction on an offset address
     that is a multiple of <expression>. The <number> parameter must be
     a power of 2 (1,2,4,8,...) less than or equal to the alignment of
     the current segment. If <number> is omitted, the alignment is
     determined by the align field of the preceding SEGMENT directive.

     In a segment containing no instructions, the assembler pads each

     skipped byte with nulls (00h). In a code segment, the assembler
     inserts a no-operation sequence (not necessarily NOP instructions)
     to fill the gap.

     This directive is useful for optimizing data and instruction
     fetches on processors with 16 or 32 bit data paths.

     EVEN is a synonym for ALIGN 2.

Gustav


> use "Align 8" in your .data section or code will accomplish the same thing.

I doubt that. Besides that for most masm versions error "invalid combination with segment alignment" will occur this statement does *not* control alignment of members in structures. And as for structure/union alignment parameter, my experiments with MASM have given me the impression that parameter "8" doesn't work.


hutch--

If your application is fussy, you need both, align the start of the structure with the align directive than set the structure to the alignment your require.


Name STRUCT 8
  members etc ...
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

GM

"STRUCT 8" works fine.

Thank you.