-
January 10th, 2004, 05:21 PM
#16
Originally posted by kasracer
You do realize that proves my point, right? It shows that f() means the samething as f(void).
let me spell it out then. you said:
Originally posted by kasracer
Do not pass void to functions in C++.
...
Because the C++ standard says NOT to.
and you were wrong - there's no such interdiction in the C++ standard.
Originally posted by kasracer
Besides, when I did a search for 8.3.5.1 I didn't find ANYTHING, but in the standard in 8.3.5 it mentions restricts the use of void as parameter type
My bad - the quote I gave was from Appendix C (C1.6 Clause 8: Declarators). However, you seem to have read 8.3.5 incompletely, since it explicitly says (again) that (void) is equivalent to (). The reason is this is an incompatibility with the C standard where () means no parameter specification. I presume you were referring to the following from 8.3.5.2 (your quote is not verbatim):
If the parameter-declaration-clause is empty, the function takes no arguments. The parameter list (void) is equivalent to the empty parameter list. Except for this special case, void shall not be a parameter type (though types derived from void, such as void*, can).
so yes, it's restricted EXCEPT for this case.
Originally posted by kasracer
I don't even know why you would top this thread now, it's a bit late.
if you check the thread, nobody had previously corrected the original poster's mistake about confusing iostream objects (in particular cout) with STL objects. second, nobody corrected your assertion about (void) being forbidden. It's only longer to write than (). Some people actually prefer to put it explicitly when they deal with both C and C++ code just to avoid confusions.
Given that the thread was in a 'forum highlights' issue, uncorrected mistakes after such a long time can damaging. Speaking of which, the reccomended use of STLport is overkill. g++ has a complete implementation of STL, no need to download a different one unless there's some obscure implementation incompatibility that one wants to avoid when moving between platforms.
-
January 10th, 2004, 06:23 PM
#17
Originally posted by abc_coder
to use C++ standard objects you need to link against the implementing library
How is that done for VC? I am not aware of doing that for VC. If I need to do it for VC then I don't know how it is done and I don't know how it is possible to not do it.
-
January 10th, 2004, 07:53 PM
#18
Back to the OP's question. I have limited experience with Linux, but when I need to use a certain STL implementation I pass the path of the headers to the compiler using (if my memory serves me right) the -I option, like
Code:
gcc -I path_to_stl file.cpp file.o
There probably are more option switches in that command, I'm just illustrating.
HTH,
-
January 10th, 2004, 10:48 PM
#19
Originally posted by Sam Hobbs
How is that done for VC? I am not aware of doing that for VC. If I need to do it for VC then I don't know how it is done and I don't know how it is possible to not do it.
But the OP and what abc_coder is talking about has nothing related to VC.
That s just a thought...
Regardlessly,
Homestead
-
January 10th, 2004, 10:56 PM
#20
Originally posted by Gabriel Fleseriu
Back to the OP's question. I have limited experience with Linux, but when I need to use a certain STL implementation I pass the path of the headers to the compiler using (if my memory serves me right) the -I option, like
Code:
gcc -I path_to_stl file.cpp file.o
There probably are more option switches in that command, I'm just illustrating.
HTH,
the compiler will usually have a list of standard search paths; same goes for the linker. in particular, in Lunix g++ (the c++ compiler) will add to the standard include search path (/usr/include) the path to where its c++ headers are installed (usually /usr/include/c++/x.y.x/ where x.y.z is the g++ version). thus if you're using the compiler's version of the library no header path is required, otherwise (or if using the generic gcc frontend) use the -I switch. same goes for the stdc++ library: g++ links it automatically, while gcc needs an explicit mention.
Originally posted by Sam Hobbs
How is that done for VC? I am not aware of doing that for VC.
VC does it automatically for you (depending on what type of project you selected). check for instance the project's linker options for the list of libraries that it's linking against.
-
January 10th, 2004, 11:05 PM
#21
Originally posted by Homestead
But the OP and what abc_coder is talking about has nothing related to VC.
It definitely is related to VC. VC implements the standard, and the comment I replied to said "to use C++ standard objects you need to link against the implementing library". That comment said "C++ standard", therefore VC is relevant. I know that this is the non-VC forum, but unless that statement is relevant to all compilers except VC, then VC is an example that applies to the other relevant compilers.
-
January 10th, 2004, 11:11 PM
#22
Originally posted by Gabriel Fleseriu
Back to the OP's question. I have limited experience with Linux, but when I need to use a certain STL implementation I pass the path of the headers to the compiler using (if my memory serves me right) the -I option, like
Code:
gcc -I path_to_stl file.cpp file.o
There probably are more option switches in that command, I'm just illustrating.
HTH,
The original question asks about a linker error, implying that there is not a problem compiling, implying tat there is not a problem with the compiler finding the path of the headers.
-
January 10th, 2004, 11:18 PM
#23
Originally posted by abc_coder
VC does it automatically for you (depending on what type of project you selected). check for instance the project's linker options for the list of libraries that it's linking against.
There is nothing linked for the STL by VC. All of the STL is implemented in the headers. Since VC uses the Dinkumware implementation (right?) this would apply to other compilers (the ones that use the Dinkumware implementation) and all users of the Dinkumware implementation (since it can be purchased separately from a compiler).
-
January 11th, 2004, 12:47 AM
#24
Originally posted by Sam Hobbs
It definitely is related to VC. VC implements the standard, and the comment I replied to said " to use C++ standard objects you need to link against the implementing library".
I apologize for the imprecision - that was referring to precompiled objects/classes that need to be linked in (the OP had a linking problem due to cout). As you already said, STL resides usually only in headers (there can be exceptions of custom non-template parts that are compiled in by some implementations).
the point was the OP's (total?! ) confusion about what STL is:
I tried to use the iostream template class in the STL library
peace!
-
January 11th, 2004, 01:37 AM
#25
Is it true that VC uses the Dinkumware implementation ?
How do people know that ? Where can I find a specification to let me know that ?
Thanks
BestRegards,
homestead
-
January 11th, 2004, 05:32 AM
#26
It s really hard to get any help ?
Regards,
homestead
-
January 11th, 2004, 05:52 AM
#27
Originally posted by Homestead
Is it true that VC uses the Dinkumware implementation ?
Although this is being off-topic for this thread...yes, VC uses the Dinkumware STL implementation by default...
-
January 11th, 2004, 06:47 AM
#28
Originally posted by Andreas Masur
Although this is being off-topic for this thread...yes, VC uses the Dinkumware STL implementation by default...
I asked so because it is written in Sam's post...I didnt quote his post.
But thanks alot for your answer.
Regards,
homestead
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|