- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
According to Ansi standard, the following code should produce result:--
f(int)
//////////////////////////
But the output in Intel C++ Compiler for windows is :--
f(char)
Even if we use /Za (for strict-ansi in windows), above is the result.
Though in Linux environment, for Intel C++ Compiler (or gcc 4.1 compiler), the result is:--
f(int)
Is this a valid behaviour difference across both platforms, or is it a bug to be fixed
f(int)
//////////////////////////
[bash]#include////////////////////////////////void f(int) { printf("f(int)\n");} template void g(T) { f('a'); // calls f(char) should call f(int) } void f(char) { printf("f(char)\n");} int main() { g('c'); } [/bash]
But the output in Intel C++ Compiler for windows is :--
f(char)
Even if we use /Za (for strict-ansi in windows), above is the result.
Though in Linux environment, for Intel C++ Compiler (or gcc 4.1 compiler), the result is:--
f(int)
Is this a valid behaviour difference across both platforms, or is it a bug to be fixed
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The erroneous line in the code is as:--
template void g(T) {
Sorry for the type while inserting code.
template
Sorry for the type while inserting code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Our goal on Windows is to be compatible with the Microsoft compiler. It makes no difference what the C++ standard says or what Gnu does.
It looks like for this example we behave exactly the same as Windows, with or without /Za. So this is not a bug.
BTW, /Za is documented inthe Microsoft compileras "disable Microsoft extensions" -- which is not the same as strict ansi. We do not currently support a strict ansi mode on Windows.
It looks like for this example we behave exactly the same as Windows, with or without /Za. So this is not a bug.
BTW, /Za is documented inthe Microsoft compileras "disable Microsoft extensions" -- which is not the same as strict ansi. We do not currently support a strict ansi mode on Windows.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page