Page 1 of 1

DJGPP vs ANSI C++++

Posted: Tue Sep 24, 2002 3:47 pm
by soilwork
thats C++

what are the differences .. like stuff that Im going to have to change in case I want to port some code from ANSI C++ to DJGPP or viceversa


either way one thing that I know is the inline ASM

but cant someone actually mod the GPP compiller and just make this:

"asm{" a keyword so when someone uses it then the compiller knows its inline asm that follows it

and } closes it

but I dunno... if its not that hard .. Ill prolly do that to make it more compiller portable, though

WHAT ARE THE OTHER DIFFERENCES

ignore the libraries cuz Ill prolly use my own

thanks,
later

Re:DJGPP vs ANSI C++++

Posted: Tue Sep 24, 2002 11:56 pm
by Pype.Clicker
imho, the asm { ... } is not an ANSI keyword ... it's specific to Borland and Microsoft compilers ...

Re:DJGPP vs ANSI C++++

Posted: Fri Sep 27, 2002 2:49 pm
by Tim
asm is ANSI C++ and ISO C99; what you put inside asm {} blocks isn't (because it depends on the target processor).

In any case, GCC expects asm("code" : stuff), not asm { code }

Re:DJGPP vs ANSI C++++

Posted: Fri Sep 27, 2002 3:55 pm
by soilwork
thanks but are there any other differences??

cuz I can handle that or I maybe will just modify DJGPP(too much code to read though) to have asm{ as a key word and to close it with }


but OTHER DIFFERENCES.. are there any???

thanks again

Re:DJGPP vs ANSI C++++

Posted: Sat Sep 28, 2002 5:29 am
by Tim
Yes, there are a lot of differences between the BC++ asm {} block and the gcc __asm__() block. gcc's inline assembler is more powerful than any other I've used, so I'd recommend you learn how to use gcc's asm.

Re:DJGPP vs ANSI C++++

Posted: Sat Sep 28, 2002 9:13 am
by dori
Im not talking about the ASM.. Im talking about the ACTUALL C++ SYNTAX... I myself dont even use asm.. and dont need powerful stuff
I only use the asm{ to call in interupt or something like that.. I am a C++ programmer

so thats what Im asking... is there a diference in the C++ syntax??

thanks

Re:DJGPP vs ANSI C++++

Posted: Sat Sep 28, 2002 11:39 am
by Tim
There is no difference in the word "asm" (gcc and BC++ use the same keyword because it's standard C++) but there is a huge difference in what comes after.

BC++:

Code: Select all

num = 0x102;
asm
{
    mov eax, num
    int 30h
}
gcc:

Code: Select all

asm volatile ("mov %0, %%eax\n"
    "int $0x30" : : "g" (num));

Re:DJGPP vs ANSI C++++

Posted: Sat Sep 28, 2002 11:22 pm
by Schol-R-LEA
I think that the Using and Porting the GNU Compiler Collection (GCC) FAQ has the information you want, particularly the sections entitled, Language Standards Supported by GCC, Extensions to the C Language Family and Extensions to the C++ Language. Note that gcc C++ is a superset of ANSI C++, AFAIK, and most ANSI code should compile correctly in it. Furthermore, there are various command-line options which specify which standard and version to adhere to, and how closely.