Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
149 user(s) are online (138 user(s) are browsing Forums)

Members: 0
Guests: 149

more...

Support us!

Headlines

 
  Register To Post  

Are AmigaOS4 SDK compiler, MACRO compilers ?
Quite a regular
Quite a regular


See User information
Hi all,

all is in the title ...

Thank you.

Kindes Regards,
AmiDARK

All we have to decide is what to do with the time that is given to us.
Go to top
Re: Are AmigaOS4 SDK compiler, MACRO compilers ?
Just popping in
Just popping in


See User information
@freddix

I actually had to look up what macro compilers might mean, this might be it, not sure: http://en.wikipedia.org/wiki/Macro_(computer_science)

But yes you can write macros in c/c++ using the #define preprocessor statement, a classic example:

#define safe_free(x) { \
free(x);\
 x 
NULL;\
}

Go to top
Re: Are AmigaOS4 SDK compiler, MACRO compilers ?
Quite a regular
Quite a regular


See User information
@Shadow
Ok

It's what I suspected but I wasn't sure ...
but is there a way to create MACROS like it was possible with DEVPAC 3 ?

Sample :
Macro MyFunction /1, /2
  
/Allocate Memory(/1, /2);
 
EndMACRO


Will then give this for example:
MyFunction MyPointer2048


and compiler will change this with :
/Allocate MemoryMyPointer2048 );


Is it possible ?

All we have to decide is what to do with the time that is given to us.
Go to top
Re: Are AmigaOS4 SDK compiler, MACRO compilers ?
Just popping in
Just popping in


See User information
@freddix

C++ uses the same macro syntax as C. Your example would be done with parentheses around the passed parameters and commas separating them.

If you need to make Assembly macros you'll have to do it with Gas (the GNU Assembler used by GCC on the PPC Amiga). I'm not sure if it even has macro processing functions since it is intended primarily for use as a compiler backend.

Go to top
Re: Are AmigaOS4 SDK compiler, MACRO compilers ?
Quite a regular
Quite a regular


See User information
@freddix

#define addition(a,b) ((a)+(b))

int mainvoid )
{
  
int ires addition12);

  
long lres additionires1569 );

  
double dres addition15/34/);

  return 
0;
}


Should be enough, isn't it ?

Back to a quiet home... At last
Go to top
Re: Are AmigaOS4 SDK compiler, MACRO compilers ?
Quite a regular
Quite a regular


See User information
@abalaban
I think "Yes".
I did already understand when Samurai Crow answered :p

I used this a lot in DEVPAC and it was really useful.

Thank you both.

All we have to decide is what to do with the time that is given to us.
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project