On one particular compiler, this program fails to compile because
memset is an undeclared symbol (it's in namespace std but not in
the global namespace):
#include <cstring>
#include <string.h>
int main()
{
char a[10];
memset(&a, '\0', 10);
return 0;
}
But if the first line is removed then the program compiles.
Apparently what is happening is that the include guards activated
by <cstringmean that the second include is ignored.
Should this be considered a compiler bug? 7 2296
"Old Wolf" <ol*****@inspire.net.nzwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
On one particular compiler, this program fails to compile because
memset is an undeclared symbol (it's in namespace std but not in
the global namespace):
#include <cstring>
#include <string.h>
int main()
{
char a[10];
memset(&a, '\0', 10);
return 0;
}
But if the first line is removed then the program compiles.
Apparently what is happening is that the include guards activated
by <cstringmean that the second include is ignored.
Should this be considered a compiler bug?
I wouldn't think so. I think it would be more a programmer error to include
both Cxxxx and xxxx.h
Old Wolf wrote:
On one particular compiler, this program fails to compile because
memset is an undeclared symbol (it's in namespace std but not in
the global namespace):
#include <cstring>
#include <string.h>
int main()
{
char a[10];
memset(&a, '\0', 10);
return 0;
}
But if the first line is removed then the program compiles.
Apparently what is happening is that the include guards activated
by <cstringmean that the second include is ignored.
Should this be considered a compiler bug?
cstring includes and will call string.h if syntax or compile errors
popped up
Old Wolf ha escrito:
On one particular compiler, this program fails to compile because
memset is an undeclared symbol (it's in namespace std but not in
the global namespace):
#include <cstring>
#include <string.h>
int main()
{
char a[10];
memset(&a, '\0', 10);
return 0;
}
But if the first line is removed then the program compiles.
Apparently what is happening is that the include guards activated
by <cstringmean that the second include is ignored.
Should this be considered a compiler bug?
It's a commpiler bug, you shold read document ?
Davio C. Doug
Old Wolf ha escrito:
On one particular compiler, this program fails to compile because
memset is an undeclared symbol (it's in namespace std but not in
the global namespace):
#include <cstring>
#include <string.h>
int main()
{
char a[10];
memset(&a, '\0', 10);
return 0;
}
But if the first line is removed then the program compiles.
Apparently what is happening is that the include guards activated
by <cstringmean that the second include is ignored.
Should this be considered a compiler bug?
It's a commpiler bug, you shold read document ?
Davio C. Doug
Moli King wrote:
Old Wolf ha escrito:
On one particular compiler, this program fails to compile because
memset is an undeclared symbol (it's in namespace std but not in
the global namespace):
#include <cstring>
#include <string.h>
int main()
{
char a[10];
memset(&a, '\0', 10);
return 0;
}
But if the first line is removed then the program compiles.
Apparently what is happening is that the include guards activated
by <cstringmean that the second include is ignored.
Should this be considered a compiler bug?
It's a commpiler bug, you shold read document ?
Davio C. Doug
that's posibly a good "guess" but at least good compiler doesnot give
priority to which header shoud be read first, header knows which to
include and to exclude
Jim Langston wrote:
"Old Wolf" <ol*****@inspire.net.nzwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
On one particular compiler, this program fails to compile because
memset is an undeclared symbol (it's in namespace std but not in
the global namespace):
#include <cstring>
#include <string.h>
int main()
{
char a[10];
memset(&a, '\0', 10);
return 0;
}
But if the first line is removed then the program compiles.
Apparently what is happening is that the include guards activated
by <cstringmean that the second include is ignored.
Should this be considered a compiler bug?
I wouldn't think so. I think it would be more a programmer error to include
both Cxxxx and xxxx.h
I find that including both files is a baad haabit of coders. but why
compiler error ?
it must be a compiler bug instead :-p
Jim Langston wrote:
"Old Wolf" <ol*****@inspire.net.nzwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
>On one particular compiler, this program fails to compile because memset is an undeclared symbol (it's in namespace std but not in the global namespace):
#include <cstring> #include <string.h>
int main() { char a[10]; memset(&a, '\0', 10); return 0; }
But if the first line is removed then the program compiles. Apparently what is happening is that the include guards activated by <cstringmean that the second include is ignored.
Should this be considered a compiler bug?
I wouldn't think so.
I would: where in the standard do you find the permission that one header
may hide the contents of another header?
I think it would be more a programmer error to
include both Cxxxx and xxxx.h
True but irrelevant for assesing whether the compiler is compliant.
Best
Kai-Uwe Bux This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: John Tiger |
last post by:
Can anybody have idea about the difference between #include
<iostream.h> and
#include <iostream>. Is later one valid statement on any compiler. I
tried compiling on MSVC second statement give...
|
by: Danny Anderson |
last post by:
Hola!
I am working on a program where I am including a library that came with my
numerical methods textbook. The "util.h" simply includes a large number
of files. I had to change the util.h...
|
by: Matt Garman |
last post by:
What is the "best" way to copy a vector of strings to an array of
character strings? By "best", I mean most elegantly/tersely written,
but without any sacrifice in performance.
I'm writing an...
|
by: Charles L |
last post by:
I have read that the inclusion of <fstream.h> makes the inclusion of
<iostream.h> unnecessary.
Is this correct?
Charles L
|
by: Macca |
last post by:
Hi,
I have been using <fstream.h> in stdafx.h,(i'm using MFC) to output to
text files. I have now started to use vectors and when i added
#include <vector>
using namespace std;
to...
|
by: howachen |
last post by:
from many books said, to use strlen(), you need to include <cstringor
<string.h>, but i found the following program work, why?
#include <iostream>
using namespace std;
int main() {
char...
|
by: Randeh |
last post by:
Short story: in a beginning C++ class in college, was in a car accident that caused central spinal stenosis, some new Schmorl's nodes, disc problems and an incredible amount of pain. So far I've...
|
by: Peithon |
last post by:
Hi,
I'm trying to create a vector of strings and print the contents using
an iterator but I'm getting
an error with my very first string.
Can anyone help?
|
by: Carmen Sei |
last post by:
it seem to me that when doing include -
#include <string.h- is CRT
#inlcude <string- is C++ standard library
Is that true those header with .h extension is CRT and those without
extension...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |