DJGPP vs ANSI C++++

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
soilwork

DJGPP vs ANSI C++++

Post 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
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:DJGPP vs ANSI C++++

Post by Pype.Clicker »

imho, the asm { ... } is not an ANSI keyword ... it's specific to Borland and Microsoft compilers ...
Tim

Re:DJGPP vs ANSI C++++

Post 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 }
soilwork

Re:DJGPP vs ANSI C++++

Post 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
Tim

Re:DJGPP vs ANSI C++++

Post 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.
dori

Re:DJGPP vs ANSI C++++

Post 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
Tim

Re:DJGPP vs ANSI C++++

Post 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));
Schol-R-LEA

Re:DJGPP vs ANSI C++++

Post 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.
Post Reply