AllocVecTags

This forum is for general developer support questions.
Post Reply
JosDuchIt
Posts: 291
Joined: Sun Jun 26, 2011 5:47 pm
Contact:

AllocVecTags

Post by JosDuchIt »

What AllocVecTags call would best replace
AllocMem(sizeof(struct Mystruct), 0);
would
AllocVecTags(sizeof(struct Mystruct), TAG_END) do ?

Code: Select all


struct dos_info
{	
	char *cb;			 /* copy buffer */
	LONG cbsize;		 /* size of copy buffer */
	BPTR rootlk; 
	BPTR destlk;
	char rt[25600];		 /* root name, exagerrated length */
	char dest[25600];	 /* destination name, exagerrated length*/
	int  newpath, rootend, destend;
	LONG size;
	LONG protflag;
}; 

int main(void)  ///char *dirname)
{
  struct dos_info *ds; 
if((ds=AllocVecTags(sizeof(struct dos_info),TAG_END)))
	Printf("size %d\n", sizeof(struct dos_info)); /// size 0

FreeVec (ds);
if((ds=AllocVecTags(sizeof(struct dos_info), AVT_Type, MEMF_SHARED, TAG_END)))
	Printf("size %d\n", sizeof(struct dos_info)); /// size 0

FreeVec (ds);

}
In the test i don't see a difference, but then i did not expect to have the Printf idenitfy a size of 0.

Is omething wrong with my test ?
User avatar
thomasrapp
Posts: 310
Joined: Sat Jun 18, 2011 11:22 pm

Re: AllocVecTags

Post by thomasrapp »

You need to use %ld. %d is short word but the compiler puts long words on the stack.
JosDuchIt
Posts: 291
Joined: Sun Jun 26, 2011 5:47 pm
Contact:

Re: AllocVecTags

Post by JosDuchIt »

@thomasrapp
thanks.
Post Reply