I want to know that if I want to set Dev-C++ to compile only ANSI c++ (exclude GNU c++ grammar).
The purpose is I want to find the difference between ANSI c++ and GNU c++.
If it can be set,when I compile the source code that include GNU c++ grammar with only ANSI c++ compiler,it will be error,right?
thanks a lot
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have already read the article from the link on the top,and I found something.
That is ,
8) -ansi : Turns off features of gnu C which are incompatible with ANSI C. This does not put a complete ban on non-ANSI programs. Certain Turbo C features will work. A "-pedantic" option is required to force strict conformance to the ANSI standard.
And I use -ansi option to compile GNU c++ source code,but it still work.The code is below,
I declare typedef in source code to make it error when compile with ANSI C++ compiler.
I do something wrong? or the typedef that I declare is not a pure GNU c++ grammar?
please help, thanks again.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2006-05-25
What is non-ANSI (actually non-ISO) about declaring a typedef?
The double underscore is specifically mandated by the ISO standard for local extensions. In ISO C++ all keywords with a double underscore are regarded as reserved words. As such __builtin_va_list is ISO compliant. The double underscore serves as a warning that the symbol is an extension and therefore not necessarily portable.
As an example consider the -fno-gnu-keywords option. Its description is as follows:
"Do not recognize typeof as a keyword, so that code can use this word as an identifier. You can use the keyword typeof instead. -ansi implies -fno-gnu-keywords."
i.e. typof is not ANSI, wheras typeofis because it conforms to the double underscore requirement.
The full manual for GCC is at http://gcc.gnu.org/onlinedocs/ it details all the options for standards compliance and also the extensions.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The manual Clifford gave you the link for has a section on where GCC differes with (does not comply with) the ANSI standard. It is quite illuminating.
Note that Sourceforge has taken to truncating links - so you will need to copy and paste it into your browser. The version of GCC used by Dev is gcc-3.4.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2006-06-01
In the recent versions of GCC all of the GNU extensions are ISO compliant (i.e. use double underscore), so what you are asking may not be possible. Some extensions, keywords, and behaviour are supported for compatibility with legacy code, but generally have to be enabled with additional options rather than disabled with the -ansi option.
You should probabbly stop thinking about GNU C++ as a different language, it is not, it is simply a C++ compiler.
You said you were doing research (but did not say why), but it seems that you are attempting to take a shortcut by asking others to do it for you. Moreover I would question the legitimacy of any research based on information from unknown sources of unknown qualification on a public forum!
There is probably no short-cut to this but to read the manuals and documentation I indicated; at least in that case your research will have referencable source material of known provenance. If you are serious about this research, then you should also obtain a copy of teh ISO standards that you are comparing against.
Earlier I suggested that you need to specify the scope of your research in terms of the specific toolchain and specific standard you are comparing. You did not do that. I would question your whole approach to 'research' as lacking rigour.
Also this is the Bloodshed software forum - Bloodshed do not write the compiler; there are more appropriate places to seek information about the compiler: http://www.mingw.org http://gcc.gnu.org
news://news:comp.lang.c++
news://comp.lang.c++.moderated
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Please do not guess before I post the reply.It is not a school project.Although it sound like same as.
Mr.Clifford, please accept apologize.
I'm sorry if I do not introduce myself before.I'm not a native English spoken,so that is why i do not introduce myself.I'm afraid that I can not communicate in english forum well. I am 22 years old.I am a developer and I have just start my working in the office on January.I am a newbie in C++ language and this research is a part of my jobs.
Before I'm decide to posting in this forum.I'm try to find the solution by myself. In first time, I don't know anything except ANSI c++ grammar that I have read in my native language books and a little bit in english specification. I try to find GNU c++ compiler by searching in google and I found GCC compiler for compile the source codes. I found MinGW and Cygwin for IDE tools. I don't know Dev-c++ using MinGW runtime and GCC until I try to config the option and after I read help of Dev-c++ I have found it can override build command in project option.And before I found the override option, I download the turbo c++ to compile on ANSI c++ only.My senior manager told me turbo c++ has the option to select only ANSI compiler.But I forgot something, turbo c++ release in 1990 it doesn't has even iostream library.So if you want to know my jobs,Please read the next paragraph.
My team has 4 people and the scope of this project is research c++ language structure(everything relate to c++), so main scope is ANSI C++ because it is the main structure,right? but the problem is there are many c++ provider.
Then the scope has separate to 4 parts, 1 main and 3 component.The main part is ANSI c++ and 3 left are
-The complement of GNU c++ that adds on ANSI c++.
-The complement of Borland c++ that adds on ANSI c++.
-The complement of Microsoft VC++ that adds on ANSI c++.
My job is research the complement of GNU c++ that adds on ANSI c++.Before I post this message I have read manual at http://gcc.gnu.org/onlinedocs/ and I found some options and codes to be test to compile and want to ensure that codes must be found in only GNU c++ but the problem is Dev-c++ using GNU compiler,I do not have any ANSI c++ compiler only.That is why I am posting this forum.I want to configure if it possibly.
If it can not, I must be find another way because I know I disturb you for a long time.
many many thanks
Wayne,
Please do not guess before I reply. It is not a school project. Although it's sound like it.
Mr.Clifford, please accept my apology.
I'm sorry if I do not introduce myself before. I'm not a native English spoken, that is why i did not introduce myself.I'm afraid that I can not communicate in english forum well. I am 22 years old.I am a developer and I have just started my work since January.I am a newbie in C++ language and this research is a part of my jobs.
Before I decided to post in this forum.I've been trying to find the solution by myself. In the first time, I don't know anything except ANSI c++ grammar that I have read some text books that is translated in my native language and a little bit some english text book. I tried to find GNU c++ compiler by searching in google and I found GCC compiler for compile the source codes. I found MinGW and Cygwin for IDE tools. I don't know Dev-c++ using MinGW runtime and GCC until I tried to configure the option and after I read HELP in Dev-c++ I found it can override build command in project option.And before I found the override option, I downloaded the turbo c++ just to compile on ANSI c++ only. My senior manager told me turbo c++ has the option to select only ANSI compiler.But I forgot something, turbo c++ release in 1992 it doesn't even has iostream library. For your information about my jobs,Please read the next paragraph.
My team has 4 people and the scope of this project is research c++ language structure(everything relates to c++), so the major is ANSI C++ because it is the core structure,right? but the problem is there are many c++ providers.
Then the scope consists of 4 parts,namely 1 major and 3 minors. The major part is ANSI c++ and 3 minor are
-The complement of GNU c++ that adds on ANSI c++.
-The complement of Borland c++ that adds on ANSI c++.
-The complement of Microsoft VC++ that adds on ANSI c++.
My job is research the complement of GNU c++ that adds on ANSI c++.Before I post this message I have read manual at http://gcc.gnu.org/onlinedocs/ and I found some options and codes to be tested to compile and want to ensure that codes must be found in only GNU c++ but the problem is Dev-c++ using GNU compiler,I do not have any compiler that compile only ANSI c++ .That is why I am posting this forum.I want to configure, is it possible?
If it is not possible, then I must find another solution. I think I've been disturbing you for a long time.
Million thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry,Please forget message on the top. Because there are 2 parts. The first one is my original sentences and the second one is the sentences that corrects by the senior.
It is my mistake.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2006-06-02
>> The complement of GNU c++ that adds on ANSI c++.
That is too simplistic (for the other compiler's also). C++ compilers may add, omit, or simply not comply with the standard, it is not just about syntax, it is also about semantics. So the list of tasks expands to:
The complement of GNU C++ that adds on ANSI C++.
The complement of ISO C++ missing from GNU C++
The complement of GNU C++ whose sematics differ from ISO C++
The first is the easiest to answer, anything prefixed with a double underscore is an extension (but not a non-compliance as discussed earlier), simply scanning teh manual index for __ will extract these. The second two are best answered using a test suite such as that from Plumb Hall. If this is a requirement for your job, then you or your employer should be prepared to put some money into the research to purchase such a tool. Some compiler vendors publish their Plumb Hall reports.
You also persist in referring to the compilers without specifying the version. For example the following code:
for( int i = 0; i < n; i++ ){ }
int x = i ;
has different semantics in VC++ 6.0, than it does in VC++ 2005.
There are many versions of GCC, few people are now using 2.95 or earlier, which have poor C++ compliance, but versions from 3.2 to 4.1 and all those in between are in common use and have strong compliance.
The question you are asking has no simple answer. And I am not sure why you are asking it or why it worthy of paid employment - you have not explained the purpose of the research (and I suppose you don't have to, but on the face of it it seems remarkably pointless).
If this is a question of verifying that your company's code is ISO compliant, then I think that this is not best dealt with by the compiler, but rather a third party static analysis tool. Such a tool will not only test conformance to the ISO subset, but will also detect use of undefined or implementation defined behaviour, and can also enforce in-house coding standards. A tool such as QAC++ from http://www.programmingresearch.com/ for example.
What I am suggesting is that it is more productive to use software tools to measure ISO compliance of the compiler, and also to test compliance and quality of the code you are compiling. If you are intending to write safety-critical systems, such an approach is essential. The former can detect non-compliance, and the latter can enforce the avoidance of the non-compliant feature. That way the choice of compiler can be based on more important things such as generated code performance.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2006-06-07
You really have to be more discerning about how an where you get your information from the Internet. True rigour in research (which is what you said you are doing) requires that you are able to accurately reference source material.
Do you know what this material is?
Following the 'previous' links back show that this is simply a copy of GNU documentation, teh definitive versions of which I have already posted. However, more critically it is documentation for GPP - a product long since subsumed into GCC. Checking the version information reveals that the document relates to GNU C++ 1.37.1 Copyright (C) 1988 Free Software Foundation, Inc. That's 1988 notice. The link you posted into the document even mentions extensions to "ANSI standard C or in AT&T's C++" - no mention of ISO C++, which did not exist until 10 years after this document was written!
I hope you have not wasted too much time on this document, you could probably have saved yourself some time by posting this 'discovery' straight away.
I have suggested to you several times that your research is meaningless unless you are clear about what versions of the relevant software and standatds you are referring to - this includes all your source material also. Simply applying this rigour would have diverted you from this blind ally.
The official current manuals to which I have already linked have an equivilent section on C++ extensions. But you have not mentioned which version of GCC you are researching. For the most recent 4.1.1, the section is at http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/C_002b_002b-Extensions.html#C_002b_002b-Extensions, but I urge you to at least familiarise yourself with the entire document. It is available as a PDF that can be printed, which is probably more appropriate for researching.
I feel now that we are going around in circles, you were directed to the correct information very early on, appear to have completely ignored it and found for yourself exactly the wrong information, while ignoring all my advice about rigourous referencing and sourcing of your material.
You are also continuing to ignore my suggestion that this is not the most appropriate place to be seeking advice on this subject.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2006-05-26
There are many options that control the precise dialect. The manual has specific sections for options controlling dilect. Some deviations from ISO C++ are extensions, some are ommissions, some may be distinct differences in terms of semantics (although very few if any).
Generally ISO C++ code will compile correctly regardless of the options - the options are niormally ones of permissiveness, rather than semantic or syntactic difference. That is to say GCC C++ is a more-or-less a superset of ISO C++. Moreover the extensions and variations are usually either to support legacy code, to support processor architecture specific features, or to locally enforce a specific form of code generation.
You should certainly not consider them different forms of the language, they are not that. I think you might be over-concerning yourself with this issue. Perhaps a better approch would be to tell us why it concersn you ar all?
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I know the ISO c++ is a C++ standard. However, there are many compiler providers such as Borland, GNU, Microsoft etc.
To be precisely, I am doing a research on what are the complement that GNU adds on C++ standard.
library? preprocessor? If it correct,the next question is What inside the Library and preprocessor that do not have in C++ standard.
Any comments are appreciated. Thank you all in advance.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2006-05-29
The user manuals are the place for such research.
The GCC manual I have already posted a link for. Note there are manuals for several versions and not every compiler release has a manual release (because presumably either nottyhing changes, or the manual was not completed at a specific version). The most appropriate manual version for the MinGW/GCC compiler provided with Dev-C++ 4.9.9.2 is 3.4.6.
Toward the bottom of the same page, you will find a link to "CPP Manual", this is the pre-processor manual, it is separately documented.
The library is a trickier issue. Note that it is also covered by a separate and distinct ISO standard - i.e. a standard compiler could have a non-standard library and vice versa. Most commercial compilers make little distinction between the pre-precessor, compiler, library, and linker. In GNU thay are very distinct, being developed and documented by separate project teams. The library is particularly fluid because it is very easy with GCC to use an alternative standard library. In fact MinGW/GCC which is a native Windows form of the GNU compiler, does not use the GNU C library. It uses Microsoft's Visual C++ 6.0 C runtime DLL (MSVCRT.DLL). This is currently documented at http://msdn2.microsoft.com/en-us/library/59ey50w6(VS.80).aspx (it seems to move around a lot, and seems increasingly difficult to find - Microsoft would rather you used .NET). MSVCRT.DLL is a super-set of the ISO C89 library. Some C99 support is missing or implemeented differently, such as 64bit integer handling in stdio.
The GNU C++ library is used by MinGW but is simply an ISO implementation.
Note also when discussing standards compliance you have to be be specific about which standard and subsequent amendments you are applying, and which versions of the various tool components you are applying it to; as both change over time. With GCC you also have to be aware ot the configuration - i.e. what target the compiler was built for (OS, Processor, etc.) and what library it was built to use (e.g. GNU, Newlib, MSVCRT).
Probably the only way to be entirely sure about compliance is to test it withe a validation suite: e.g. http://www.plumhall.com/suites.html. However such suites will test compliance, the existance or absence of extensions cannot be tested, but as pointed out, this does not necessarily constitute a deviation from ISO since extensions are allowed. What is tested is that if you write a particular piece of code that its semantics and syntax is ISO compliant.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Oh, I forget something. The version of GCC manual that I want to research is the latest version. That's 4.1.1.
But I have a question. Why version 4.1.1 does not has "Min and Max" and "offsetof" extensions that version 3.4.6 has? or is it possible that those two extensions are in the current version of ANSI?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2006-06-07
See section "6.10 Deprecated Features", and "5.43 Offsetof" - which is my way of saying finish reading the manual first! And use the index/contents! - I still seem to be doing your work.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello all,
I want to know that if I want to set Dev-C++ to compile only ANSI c++ (exclude GNU c++ grammar).
The purpose is I want to find the difference between ANSI c++ and GNU c++.
If it can be set,when I compile the source code that include GNU c++ grammar with only ANSI c++ compiler,it will be error,right?
thanks a lot
GCC options you should know
http://www.freeos.com/articles/3185/
I have already read the article from the link on the top,and I found something.
That is ,
8) -ansi : Turns off features of gnu C which are incompatible with ANSI C. This does not put a complete ban on non-ANSI programs. Certain Turbo C features will work. A "-pedantic" option is required to force strict conformance to the ANSI standard.
And I use -ansi option to compile GNU c++ source code,but it still work.The code is below,
//begin
include <cstdlib>
include <iostream>
typedef __builtin_va_list a;
using namespace std;
int main(int argc, char *argv[])
{
system("PAUSE");
return EXIT_SUCCESS;
}
//end
I declare typedef in source code to make it error when compile with ANSI C++ compiler.
I do something wrong? or the typedef that I declare is not a pure GNU c++ grammar?
please help, thanks again.
What is non-ANSI (actually non-ISO) about declaring a typedef?
The double underscore is specifically mandated by the ISO standard for local extensions. In ISO C++ all keywords with a double underscore are regarded as reserved words. As such __builtin_va_list is ISO compliant. The double underscore serves as a warning that the symbol is an extension and therefore not necessarily portable.
As an example consider the -fno-gnu-keywords option. Its description is as follows:
"Do not recognize typeof as a keyword, so that code can use this word as an identifier. You can use the keyword typeof instead. -ansi implies -fno-gnu-keywords."
i.e. typof is not ANSI, wheras typeofis because it conforms to the double underscore requirement.
The full manual for GCC is at http://gcc.gnu.org/onlinedocs/ it details all the options for standards compliance and also the extensions.
Clifford
Thanks to Mr.Clifford, but I am still confused a little bit.
Can you tell me the different between GNU c++ and ANSI c++?
Just only library? grammar? or predefine?
and Can you give me some examples?
thanks in your advance.
The manual Clifford gave you the link for has a section on where GCC differes with (does not comply with) the ANSI standard. It is quite illuminating.
Note that Sourceforge has taken to truncating links - so you will need to copy and paste it into your browser. The version of GCC used by Dev is gcc-3.4.
Wayne
In the recent versions of GCC all of the GNU extensions are ISO compliant (i.e. use double underscore), so what you are asking may not be possible. Some extensions, keywords, and behaviour are supported for compatibility with legacy code, but generally have to be enabled with additional options rather than disabled with the -ansi option.
You should probabbly stop thinking about GNU C++ as a different language, it is not, it is simply a C++ compiler.
You said you were doing research (but did not say why), but it seems that you are attempting to take a shortcut by asking others to do it for you. Moreover I would question the legitimacy of any research based on information from unknown sources of unknown qualification on a public forum!
There is probably no short-cut to this but to read the manuals and documentation I indicated; at least in that case your research will have referencable source material of known provenance. If you are serious about this research, then you should also obtain a copy of teh ISO standards that you are comparing against.
Earlier I suggested that you need to specify the scope of your research in terms of the specific toolchain and specific standard you are comparing. You did not do that. I would question your whole approach to 'research' as lacking rigour.
Also this is the Bloodshed software forum - Bloodshed do not write the compiler; there are more appropriate places to seek information about the compiler:
http://www.mingw.org
http://gcc.gnu.org
news://news:comp.lang.c++
news://comp.lang.c++.moderated
Clifford
I've had the sense of some form of school project for this line of questioning for a while now.
Wayne
Wayne,
Please do not guess before I post the reply.It is not a school project.Although it sound like same as.
Mr.Clifford, please accept apologize.
I'm sorry if I do not introduce myself before.I'm not a native English spoken,so that is why i do not introduce myself.I'm afraid that I can not communicate in english forum well. I am 22 years old.I am a developer and I have just start my working in the office on January.I am a newbie in C++ language and this research is a part of my jobs.
Before I'm decide to posting in this forum.I'm try to find the solution by myself. In first time, I don't know anything except ANSI c++ grammar that I have read in my native language books and a little bit in english specification. I try to find GNU c++ compiler by searching in google and I found GCC compiler for compile the source codes. I found MinGW and Cygwin for IDE tools. I don't know Dev-c++ using MinGW runtime and GCC until I try to config the option and after I read help of Dev-c++ I have found it can override build command in project option.And before I found the override option, I download the turbo c++ to compile on ANSI c++ only.My senior manager told me turbo c++ has the option to select only ANSI compiler.But I forgot something, turbo c++ release in 1990 it doesn't has even iostream library.So if you want to know my jobs,Please read the next paragraph.
My team has 4 people and the scope of this project is research c++ language structure(everything relate to c++), so main scope is ANSI C++ because it is the main structure,right? but the problem is there are many c++ provider.
Then the scope has separate to 4 parts, 1 main and 3 component.The main part is ANSI c++ and 3 left are
-The complement of GNU c++ that adds on ANSI c++.
-The complement of Borland c++ that adds on ANSI c++.
-The complement of Microsoft VC++ that adds on ANSI c++.
My job is research the complement of GNU c++ that adds on ANSI c++.Before I post this message I have read manual at http://gcc.gnu.org/onlinedocs/ and I found some options and codes to be test to compile and want to ensure that codes must be found in only GNU c++ but the problem is Dev-c++ using GNU compiler,I do not have any ANSI c++ compiler only.That is why I am posting this forum.I want to configure if it possibly.
If it can not, I must be find another way because I know I disturb you for a long time.
many many thanks
Wayne,
Please do not guess before I reply. It is not a school project. Although it's sound like it.
Mr.Clifford, please accept my apology.
I'm sorry if I do not introduce myself before. I'm not a native English spoken, that is why i did not introduce myself.I'm afraid that I can not communicate in english forum well. I am 22 years old.I am a developer and I have just started my work since January.I am a newbie in C++ language and this research is a part of my jobs.
Before I decided to post in this forum.I've been trying to find the solution by myself. In the first time, I don't know anything except ANSI c++ grammar that I have read some text books that is translated in my native language and a little bit some english text book. I tried to find GNU c++ compiler by searching in google and I found GCC compiler for compile the source codes. I found MinGW and Cygwin for IDE tools. I don't know Dev-c++ using MinGW runtime and GCC until I tried to configure the option and after I read HELP in Dev-c++ I found it can override build command in project option.And before I found the override option, I downloaded the turbo c++ just to compile on ANSI c++ only. My senior manager told me turbo c++ has the option to select only ANSI compiler.But I forgot something, turbo c++ release in 1992 it doesn't even has iostream library. For your information about my jobs,Please read the next paragraph.
My team has 4 people and the scope of this project is research c++ language structure(everything relates to c++), so the major is ANSI C++ because it is the core structure,right? but the problem is there are many c++ providers.
Then the scope consists of 4 parts,namely 1 major and 3 minors. The major part is ANSI c++ and 3 minor are
-The complement of GNU c++ that adds on ANSI c++.
-The complement of Borland c++ that adds on ANSI c++.
-The complement of Microsoft VC++ that adds on ANSI c++.
My job is research the complement of GNU c++ that adds on ANSI c++.Before I post this message I have read manual at http://gcc.gnu.org/onlinedocs/ and I found some options and codes to be tested to compile and want to ensure that codes must be found in only GNU c++ but the problem is Dev-c++ using GNU compiler,I do not have any compiler that compile only ANSI c++ .That is why I am posting this forum.I want to configure, is it possible?
If it is not possible, then I must find another solution. I think I've been disturbing you for a long time.
Million thanks.
Sorry,Please forget message on the top. Because there are 2 parts. The first one is my original sentences and the second one is the sentences that corrects by the senior.
It is my mistake.
>> The complement of GNU c++ that adds on ANSI c++.
That is too simplistic (for the other compiler's also). C++ compilers may add, omit, or simply not comply with the standard, it is not just about syntax, it is also about semantics. So the list of tasks expands to:
The first is the easiest to answer, anything prefixed with a double underscore is an extension (but not a non-compliance as discussed earlier), simply scanning teh manual index for __ will extract these. The second two are best answered using a test suite such as that from Plumb Hall. If this is a requirement for your job, then you or your employer should be prepared to put some money into the research to purchase such a tool. Some compiler vendors publish their Plumb Hall reports.
You also persist in referring to the compilers without specifying the version. For example the following code:
for( int i = 0; i < n; i++ ){ }
int x = i ;
has different semantics in VC++ 6.0, than it does in VC++ 2005.
There are many versions of GCC, few people are now using 2.95 or earlier, which have poor C++ compliance, but versions from 3.2 to 4.1 and all those in between are in common use and have strong compliance.
The question you are asking has no simple answer. And I am not sure why you are asking it or why it worthy of paid employment - you have not explained the purpose of the research (and I suppose you don't have to, but on the face of it it seems remarkably pointless).
If this is a question of verifying that your company's code is ISO compliant, then I think that this is not best dealt with by the compiler, but rather a third party static analysis tool. Such a tool will not only test conformance to the ISO subset, but will also detect use of undefined or implementation defined behaviour, and can also enforce in-house coding standards. A tool such as QAC++ from http://www.programmingresearch.com/ for example.
What I am suggesting is that it is more productive to use software tools to measure ISO compliance of the compiler, and also to test compliance and quality of the code you are compiling. If you are intending to write safety-critical systems, such an approach is essential. The former can detect non-compliance, and the latter can enforce the avoidance of the non-compliant feature. That way the choice of compiler can be based on more important things such as generated code performance.
Clifford
Thank you for your suggestion,
Finally, I have found some user's guide about GNU extentions.But I have to read that user's guide before I reply and paste the link.
Thanks,
coming soon!!
Thank you for your suggestion,
Finally, I have found some user's guide about GNU extentions.But I have to read that user's guide before I reply and paste the link.
Thanks,
coming soon!!
P.S. I don't know why I'm not login.
Please see the link below,
http://www.ictp.trieste.it/texi/gpp/gpp_16.html#SEC10
What do you think about this user's guide?
You really have to be more discerning about how an where you get your information from the Internet. True rigour in research (which is what you said you are doing) requires that you are able to accurately reference source material.
Do you know what this material is?
Following the 'previous' links back show that this is simply a copy of GNU documentation, teh definitive versions of which I have already posted. However, more critically it is documentation for GPP - a product long since subsumed into GCC. Checking the version information reveals that the document relates to GNU C++ 1.37.1 Copyright (C) 1988 Free Software Foundation, Inc. That's 1988 notice. The link you posted into the document even mentions extensions to "ANSI standard C or in AT&T's C++" - no mention of ISO C++, which did not exist until 10 years after this document was written!
I hope you have not wasted too much time on this document, you could probably have saved yourself some time by posting this 'discovery' straight away.
I have suggested to you several times that your research is meaningless unless you are clear about what versions of the relevant software and standatds you are referring to - this includes all your source material also. Simply applying this rigour would have diverted you from this blind ally.
The official current manuals to which I have already linked have an equivilent section on C++ extensions. But you have not mentioned which version of GCC you are researching. For the most recent 4.1.1, the section is at http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/C_002b_002b-Extensions.html#C_002b_002b-Extensions, but I urge you to at least familiarise yourself with the entire document. It is available as a PDF that can be printed, which is probably more appropriate for researching.
If you are using Dev-C++ 4.9.9.2, then this is shipped with an earlier version of GCC and the relevent page is at: http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/C_002b_002b-Extensions.html#C_002b_002b-Extensions, which you will note differs from 4.1.1, which is why I say teh question is meaningless unless you are clear about the version you are comparing.
I feel now that we are going around in circles, you were directed to the correct information very early on, appear to have completely ignored it and found for yourself exactly the wrong information, while ignoring all my advice about rigourous referencing and sourcing of your material.
You are also continuing to ignore my suggestion that this is not the most appropriate place to be seeking advice on this subject.
Clifford
Thank you,
Please don't be offened. Now, I see the light.
I'll have to study GCC manual therefor I'll be away for some time, please don't miss me. :)
Thanks
There are many options that control the precise dialect. The manual has specific sections for options controlling dilect. Some deviations from ISO C++ are extensions, some are ommissions, some may be distinct differences in terms of semantics (although very few if any).
Generally ISO C++ code will compile correctly regardless of the options - the options are niormally ones of permissiveness, rather than semantic or syntactic difference. That is to say GCC C++ is a more-or-less a superset of ISO C++. Moreover the extensions and variations are usually either to support legacy code, to support processor architecture specific features, or to locally enforce a specific form of code generation.
You should certainly not consider them different forms of the language, they are not that. I think you might be over-concerning yourself with this issue. Perhaps a better approch would be to tell us why it concersn you ar all?
Clifford
Thank you Mr.Clifford again,
I know the ISO c++ is a C++ standard. However, there are many compiler providers such as Borland, GNU, Microsoft etc.
To be precisely, I am doing a research on what are the complement that GNU adds on C++ standard.
library? preprocessor? If it correct,the next question is What inside the Library and preprocessor that do not have in C++ standard.
Any comments are appreciated. Thank you all in advance.
The user manuals are the place for such research.
The GCC manual I have already posted a link for. Note there are manuals for several versions and not every compiler release has a manual release (because presumably either nottyhing changes, or the manual was not completed at a specific version). The most appropriate manual version for the MinGW/GCC compiler provided with Dev-C++ 4.9.9.2 is 3.4.6.
Toward the bottom of the same page, you will find a link to "CPP Manual", this is the pre-processor manual, it is separately documented.
The library is a trickier issue. Note that it is also covered by a separate and distinct ISO standard - i.e. a standard compiler could have a non-standard library and vice versa. Most commercial compilers make little distinction between the pre-precessor, compiler, library, and linker. In GNU thay are very distinct, being developed and documented by separate project teams. The library is particularly fluid because it is very easy with GCC to use an alternative standard library. In fact MinGW/GCC which is a native Windows form of the GNU compiler, does not use the GNU C library. It uses Microsoft's Visual C++ 6.0 C runtime DLL (MSVCRT.DLL). This is currently documented at http://msdn2.microsoft.com/en-us/library/59ey50w6(VS.80).aspx (it seems to move around a lot, and seems increasingly difficult to find - Microsoft would rather you used .NET). MSVCRT.DLL is a super-set of the ISO C89 library. Some C99 support is missing or implemeented differently, such as 64bit integer handling in stdio.
The GNU C++ library is used by MinGW but is simply an ISO implementation.
Note also when discussing standards compliance you have to be be specific about which standard and subsequent amendments you are applying, and which versions of the various tool components you are applying it to; as both change over time. With GCC you also have to be aware ot the configuration - i.e. what target the compiler was built for (OS, Processor, etc.) and what library it was built to use (e.g. GNU, Newlib, MSVCRT).
Probably the only way to be entirely sure about compliance is to test it withe a validation suite: e.g. http://www.plumhall.com/suites.html. However such suites will test compliance, the existance or absence of extensions cannot be tested, but as pointed out, this does not necessarily constitute a deviation from ISO since extensions are allowed. What is tested is that if you write a particular piece of code that its semantics and syntax is ISO compliant.
Clifford
Thank you,
I'll try as you suggested. I may ask if another problem arise.
Dear all,
Can you give me some examples of the pure GNU C++ source codes?
and show how to compiles the pure GNU C++ source codes with pure ANSI option. (the errors must be occur)
Many Thanks
Oh, I forget something. The version of GCC manual that I want to research is the latest version. That's 4.1.1.
But I have a question. Why version 4.1.1 does not has "Min and Max" and "offsetof" extensions that version 3.4.6 has? or is it possible that those two extensions are in the current version of ANSI?
See section "6.10 Deprecated Features", and "5.43 Offsetof" - which is my way of saying finish reading the manual first! And use the index/contents! - I still seem to be doing your work.
Clifford
Amen.