Robert Heller writes:
> Here is the relevant fragment of TrackGraph.cc:
Too hard to parse (for me anyway).
Please reduce to the minimal amount of code that allows your audience
to see what you are seeing.
___
help-gplusplus mailing list
help-gplusplus
pio...@unet.univie.ac.at (Piotr Sawuk) writes:
> In article <87bplwt40q@madbox3.site>,
> Thomas Maeder writes:
>
>> What line does the error refer to?
>>
>> And please reduce your code to the bare minimum (no more, no less)
>> that still
pio...@unet.univie.ac.at (Piotr Sawuk) writes:
> gcc-version 4.1.2
>
> error: explicit specialization in non-namespace scope 'class
> _BRInsertSort_HelperClass'
> error: enclosing class templates are not explicitly specialized
What line does the error refer to?
And please reduce your code to th
Emanoil Kotsev writes:
> Hello, I'm trying to learn a bit more of c++. Unfortunately what was
> working in g++ 4.2 is not working in 4.3 anymore. Why?
The code you give below has never been valid since C++ was stadardized
11 years ago.
> I don't think I'm suppose to be changing my code because
zak100 writes:
> Can somebody plz help me with this.
Please next time post your code in human readable form.
>From what I can tell from the unreadable form, it seems to lack a
main() function.
___
help-gplusplus mailing list
help-gplusplus@gnu.org
htt
Cary writes:
> The following code compiles, but the linker complains of an undefined
> reference. If I comment out the line with *xx* it will link. Is this
> a known and/or fixed bug in later versions of gcc?
No. It's a bug in your program.
> SLES 10.2
> gcc --version gcc (GCC) 4.1.2 2007011
mambokn...@gmail.com writes:
> With g++ v.4.3.2 instead I get the reported error.
g++ is correct.
> I would thankfully appreciate any help.
>
> volcalc.cpp:26: error: template argument for 'template
> class std::allocator' uses local type 'main(int, char**)::series'
> volcalc.cpp:26: error: t
Toby writes:
> It seems that string's find_last_not_of method isn't returning
> string::npos:
>
> void test() {
> string s = " ";
> int i = s.find_last_not_of(' ');
> cout << "i = " << i << endl // prints -1
><< "string::npos = " << string::npos
><< en
Terry IT <[EMAIL PROTECTED]> writes:
> i want to use hashmap ie an unordered hash table.
>
> how do we remove elements from hashmap
Using one of the erase() member functions. Or clear(). Or the
copy-assignment operator.
> and can we say something hashmap m; or hashmap
> m.
I think so. Have you
Randy AC7NJ <[EMAIL PROTECTED]> writes:
> myfirst.c:5: error: 'cout' was not declared in this scope
Good.
> / / myfirst.c --displays a message
If your example is from a textbook, that textbook must be pretty old.
> #include
> int main(void)
> {
> cout << "come up and C++ me sometime.
Ali <[EMAIL PROTECTED]> writes:
>
> The documentation of the interval class is here:
Please post a minimal (i.e. just enough code, not more and not less)
that allows others to copy & paste & compile & see what you are seeing.
___
help-gplusplus mailing l
kk <[EMAIL PROTECTED]> writes:
> char *str = 0;
>
> try
> {
> // int i = 0;
> // int j = 1/i; // Uncommenting this would not go into
> catch block. But gives "Floating Point Exception"
Division by 0 is undefined behavior. A platform may transform
[EMAIL PROTECTED] writes:
> enum foo
> {
> null_foo,
> foo1,
> foo2
> };
>
> template
> struct data
> {
> T val;
> bool set;
>
> template
> data& operator=(const U &that)
> {
> val = that;
> set = true;
> return *this;
> }
> };
>
> struct
gx <[EMAIL PROTECTED]> writes:
>
> template bool find0(const std::vector &v){
> for(std::vector::const_iterator it=v.begin(); it!=v.end(); +
> +it){
> if(!*it)
> return true;
> }
> return false;
> }
>
>
> I believe that the problem is
Taras_96 <[EMAIL PROTECTED]> writes:
> I tried a number of things with some test code. The test code is:
>
> #include
> #include
> #include
> #include
>
> int main()
> {
> std::string tempString = "BLAH";
> transform(tempString.begin(),tempString.end(),tempString.begin(),
>
[EMAIL PROTECTED] writes:
> I've read multiple posts about how to get the 'tolower' function to
> work in gcc. From what I understand, the problem is that there are two
> versions - you must cast to specify which version you want to use.
>
> transform(tempString.begin(),tempString.end(),tempStri
Pep <[EMAIL PROTECTED]> writes:
> Thomas Maeder wrote:
>
>> Pep <[EMAIL PROTECTED]> writes:
>>
>> > I have numeric input which I must convert to strings and validate
>> > whilst doing the conversion. I do not want to mix C functions like
>> &g
Pep <[EMAIL PROTECTED]> writes:
> I have numeric input which I must convert to strings and validate
> whilst doing the conversion. I do not want to mix C functions like
> strtol in to my c++ code, so I'm trying to implement a C++ method
> using examples found in google but none of them work :(
st
PlayDough <[EMAIL PROTECTED]> writes:
> test.cpp:
> const char test_str[] = "abcd";
>
> And I compile with g++ (mb-g++ in my case). So I do a "mb-g++ -c
> test.cpp". I'd expect test_str to be visible in the output. So, I do
> nm (mb-nm in my case), and getnothing.
Good. The const gives tes
alaudo <[EMAIL PROTECTED]> writes:
> I've got a strange problem with changing my unsigned short values from
> host to the network byte order and vice versa.
> I have a client and a server, which communicate via their own binary
> protocol. I need to send some numerical values of unsigned short typ
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:
> I'm wondering where the definitions of the functions in
> are in GCC. I can not find them in GCC source code. Could you help
> me?
>
> int i
> std::istream is;
> is >> i; // For example, I want the definition of this function (>>).
Side note: the
"wazz" <[EMAIL PROTECTED]> writes:
> I'm trying to define a simple class which extends std::string
std::string wasn't designed to serve as a non-private base class ...
> , as well as provides a method for C-style typecast.
... and, as a rule, conversion operators are a bad idea because of the
Steve Bby <[EMAIL PROTECTED]> writes:
> I compile a small program below:
>
> #include
>
> main()
Implicit has been obsolete for very long time now.
> {
> cout << "Test\n";
declares cout in name std. Refer to that object with the
name std::cout, or use a using de
[EMAIL PROTECTED] writes:
> I try to call a function implemented in the Baseclass from the
> DerivedClass.
>
> When i compiled it using VC++, the following Error was thrown
> "illegal Call to non-static member BaseClass::function() "
> But, it gets compiled with g++ in Solaris.
>
> What could be
"Henrik Goldman" <[EMAIL PROTECTED]> writes:
> fd_set fdread, fdwrite;
>
> FD_ZERO(&fdread);
>
> FD_ZERO(&fdwrite);
>
> FD_SET(m_IncomingSocket.GetSocket(), &fdread);
>
> FD_SET(m_IncomingSocket.GetSocket(), &fdwrite);
>
> For the last two lines I get the following warning:
>
> warning: dereferenc
[EMAIL PROTECTED] writes:
> I am not able to compile this with gcc4.x , it works fine with
> gcc3.2.2.
> When I include txbase.h in .C file and build
> g++ -c filename.C
> I get following error. Line 56 is ListcommonValidations;
> in txbase.h
> Based on my reading I will need to add a line in
"biz_boy" <[EMAIL PROTECTED]> writes:
> I am getting following error while compiling my C++ app on RedHat Linux
> AS 3 Update 7 64-bit OS.
>
> template-id `
>_M_insert_aux Header_s*
>const*> >' for `void std::deque
>
>>::_M_insert_aux(std::_Deque_iterator Header_s**>,
>std::_Deque_
"Siegfried" <[EMAIL PROTECTED]> writes:
> Anyway, can anyone speculate with (for) me as to why the compiler
> (and c++ specification) works this way? It does not seem logical to
> only search the std namespace. It seems that writing application
> specific code for the std namespace should be forbi
"Siegfried" <[EMAIL PROTECTED]> writes:
> Presently, the g++ 3.2 compiler is complaining that it cannot find
> operator<<(ostream, std::pair). However, it is present
> and I can call it. So why does not g++ see it when compiling std::copy?
I explained it on comp.lang.c++.moderated. Some operator<
[EMAIL PROTECTED] writes:
> Thanks. I tried this and I seem to get a number infront of the
> class name that is printed. Is this expected?
The result of typeid(*ptr).name() is implementation defined. The only
thing you can rely on is that it's a null-terminated string.
___
Ulrich Lauther <[EMAIL PROTECTED]> writes:
> inline bool almost_equal(float a, float b, int maxUlps = 16) {
> if (a == b) return true;
> int intDiff = abs(*(reinterpret_cast(&a)) -
> *(reinterpret_cast(&b)));
> return intDiff <= maxUlps;
> }
>
> I get the warning: warning:
[EMAIL PROTECTED] writes:
> Does any one know of a better way to decode the symbol generated by
> the g++ 3.4.2 after it compiles a code?
Are you thinking of something like c++filt?
% man c++filt
c++filt - Demangle C++ and Java symbols.
> I see a symbol being undefined when I link it.
"matrut" <[EMAIL PROTECTED]> writes:
> class CSignal
> {
> public:
> CSignal(void)
> {
> m_this = this;
> };
>
> ~CSignal(void);
>
> protected:
> static CSignal *m_this;
> }:
Syntax error. Please next time post real code.
> and after linking the output is af follows:
"Aj" <[EMAIL PROTECTED]> writes:
> I took over some old code and found it riddled with errors. "delete"
> is used wherever "delete[]" is needed. Some of this code is
> definitely hit several times while the code runs.
>
> My question: are delete and delete[] equivalent under g++ 3.2.2 when -g
> is
Andreas Schallenberg <[EMAIL PROTECTED]> writes:
> is there any way to make g++ (preferably) report dynamic_cast
> statements that are unnecessary? Example:
>
> class A{...};
> class B : public A {...};
> class C : public B {...};
> ...
> void myFunc(C * obj)
> {
> // redundant one...
> ... =
Artus <[EMAIL PROTECTED]> writes:
> double tab[] = {0.6, 1.0, 3.0, 10.0, 20.0, 50., 1000.};
> std::vector const myvec(tab, tab+sizeof(tab)/sizeof(double));
> /* ... */
> for (std::vector::const_iterator it = myvec.begin();
> it!=myvec.end(); ++it) {
> std::vector::difference_type i = 0;
>
Christian Christmann <[EMAIL PROTECTED]> writes:
>> 1. you generally want to divorce type declarations and variable
>> declarations.
>
> Sorry, but what do you exactly mean by that?
This:
> struct storeInfo {
> int a;
> } structInfo;
defines both a type storeInfo and a
Christian Christmann <[EMAIL PROTECTED]> writes:
>>> This:
>>>
struct storeInfo {
int a;
} structInfo;
>>>
>>> defines both a type storeInfo and an object structInfo of that
>>> type. He suggests that you first define the type and then the
>>> object, in
"solid" <[EMAIL PROTECTED]> writes:
> Thanks, but I don't see any side-effects in my program...
This copy constructor
A(const A& a) { b_ = !a.b_; }
can be called humorous at best.
Since the compiler is entitled to optimize away its invokation in
certain situations, there's now way to predict
"Studnet" <[EMAIL PROTECTED]> writes:
> I have an assignment for my Programming language project to create a
> compiler that takes a C++ file as input and translate it into the C
> file. Here I have to take care of inheritance and operator
> overloading and virtual functions. I mean it should not
Mike - EMAIL IGNORED <[EMAIL PROTECTED]> writes:
> I generally use inline when it appears that the function will not
> use much memory os is called very frequently, and is not worth the
> function call overhead.
>
> Do you have a profiler to suggest?
Sice you seem to be using gcc, why not gprof?
"swagat" <[EMAIL PROTECTED]> writes:
> But this is not what I want to do. First of all, I am accessing one
> member function by another member function where object declaration
> is not required. I want to use a pointer to access the other member
> functions within the class as demonstrated above.
"Michael D. Berger" <[EMAIL PROTECTED]> writes:
>> > "Physically", modifications on an inline member function require
>> > tranlation units depending on the definition of the member's
>> > class to be recompiled. Modifications of encapsulated member
>> > functions' definitions only require the tra
"Michael D. Berger" <[EMAIL PROTECTED]> writes:
> Are inline constructors and assignment operators ok?
> They are very short, but I head that there may be a problem.
The problems, if any, are the same as for other member functions:
Conceptually, encapsulation is at least partially broken if a cl
Long Li <[EMAIL PROTECTED]> writes:
> #include
> using std::cout;
> using std::endl;
Side note: std::endl is declared in , not (not
necessarily anyway). You'd have to #include as well.
> #include
> using std::string;
> #include
> using std::vector;
> #include
> using std::map;
> class A{
"Chris" <[EMAIL PROTECTED]> writes:
> How do I produce assembly from g++? I looked on the man pages could
> not find anything that looked like it would work.
Have you looked at -S ?
___
Help-gplusplus mailing list
Help-gplusplus@gnu.org
http://lists.gn
"JH Trauntvein" <[EMAIL PROTECTED]> writes:
> In the folloiwng code fragment, I am attempting to convert a multi-byte
> string into a wide string using the std::codecvt::out() function. I
> have found that when I do so, the compiler complains that it cannot
> find a match but then proceeds to lis
Emanuel Ziegler <[EMAIL PROTECTED]> writes:
> On Fri, 02 Dec 2005 17:53:13 +0100 Maurizio Loreti wrote:
>
>> well, the diagnostic is clear; g++ needs a prototype in scope of the
>> function to be declared friend.
>
> Ok, that works. Thanks! But why does it apply to templates only?
The moral equiv
Emanuel Ziegler <[EMAIL PROTECTED]> writes:
> template
> class FriendClass
> {
> // This line causes trouble
> friend T get_test (const FriendClass &);
> protected:
> T test;
> };
>
> template
> T get_test (const FriendClass &fc)
> {
> return fc.test;
> }
>
> int main ()
> {
> Frie
"Al-Burak" <[EMAIL PROTECTED]> writes:
> Correction
> I accidentally forgot to add the name of the namespace
As suspected.
> - name.cpp
> std::ostream& operator<<( std::ostream& os, const jme::Name& obj ) {
> return os << obj.getNameStr(); }
> std::istream& operator>>( std::istream& is,
"tengereche" <[EMAIL PROTECTED]> writes:
> This program does compile, but the linker says:
> main.o(.text+0x1a4):main.cpp: undefined reference to
> `jme::operator<<(std::ostream&, jme::Name const&)'
>
> here is the program's snips.
>
> - strtools.hpp
> namespace{
Are you sure that this is
[Why this Followup-To: header???]
"jalkadir" <[EMAIL PROTECTED]> writes:
> I my program I have overloaded the inserters and extractor operator.
> ---name.hpp
> friend std::ostream& std::operator<<( std::ostream& os,
> const jme::Name& obj );
> friend
"jalkadir" <[EMAIL PROTECTED]> writes:
> How can I conver a char[x] to std::wstring, for intance
> time_t Time_t;
> std::wstring Date;
> time( &Time_t );
> Date = ctime( &Time_t );
>
> or
> strd::string wstr;
> str = __FILE__;
>
> Isn't the conversion done automatically?
No. What encoding should
"jalkadir" <[EMAIL PROTECTED]> writes:
> void getData(){
>jme::Address address2;
>std::string str;
>char* cstr;
In general, it's a good idea to define variable where you initialize
them. If that's not possible, move the definition just above the
initialization.
Also, avoid overly lon
[EMAIL PROTECTED] writes:
> int main()
> {
> double xpos;
> double a;
> double b;
> double c;
> double square;
> double xneg;
>
> cout << "This program will compute a quadratic equation\n";
> cout << "Please enter a number: \n";
> cin >> a;
>
"Zorro" <[EMAIL PROTECTED]> writes:
> I compiled it in visual studio, and it had no errors.
> Sorry, for not having better news. It is a GCC bug.
Hardly. When gcc and a Microsoft compiler disagree, it's normally a
bug in the latter. As this time.
___
He
Simon Buchan <[EMAIL PROTECTED]> writes:
> More accurately, names begining with /two/ underscores, or an
> underscore followed by a capital are reserved for the vendor by the
> standard,
Even more accurately, names beginning with _[A-Z] or *containing* __
are reserved.
> ie:
> __special_vendor_n
"jalkadir" <[EMAIL PROTECTED]> writes:
> Can you help?
Maybe. Please post the minimal (<50 lines of code) program that
compiles and runs and illustrates your problem. This will (hopefully)
allow your audience to see what you are seeing.
___
Help-gpluspl
[EMAIL PROTECTED] writes:
> I have a class that overloads the inserter and the extractor
> operators, but there is a problem with the way I worte the methods;
> because the compiler does not like it at all.
>
> This is the snip of what the problem looks like:
>
> --- money.hpp
> friend std::ostrea
dfs sd <[EMAIL PROTECTED]> writes:
> Hi guys! I am new to the Gun tool.
Then you are wrong here. This newsgroup is about a Gnu tool (not the
order of the characters in "Gnu"). :-)
> Is it right if you want to install GUN you must install UNIX first?
No. Gnu tools run on a variety of platforms,
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:
> are porting an application from Windows to Linux. The native code is
> in VC++.
>
> We're getting the following error in g++ for the code given below...
Please post a *minimal* snippet that allows others to see what you are
seeing by copying&past
"bhagwan" <[EMAIL PROTECTED]> writes:
> We are porting an application from Windows to Linux. The native code
> is in VC++.
>
> We're getting the following error in g++ for the code given below...
Please post a *minimal* snippet that allows others to see what you are
seeing by copying&pasting&comp
Christian Christmann <[EMAIL PROTECTED]> writes:
> class HashTable
> {
> map nhash;
> map getNhash();
Consider using a typedef next time.
> ...
> }
> --
>
> My hashtable.cpp:
>
> map HashTable::getNhash()
> {
> return nhash;
> }
>
> void HashTable::Insert(int ky,vo
[EMAIL PROTECTED] writes:
> In function `void f2()':
> error: cannot convert `int s::*' to `int*' for argument `1' to `void
> f(int*)'
Is there a problem with the workaround I gave you over in gnu.gcc?
___
Help-gplusplus mailing list
Help-gplusplus@gnu.
Christian Christmann <[EMAIL PROTECTED]> writes:
> my program contains a class with a STL vector std::vector data and an
> integer variable "currentbit" which indicates the current position while
> traversing the vector.
[snip]
Next time please post minimal code rather than describing it.
> ve
"Srini" <[EMAIL PROTECTED]> writes:
> -- buffer.h --
> #ifndef _BUFFER_H_
> #define _BUFFER_H_
This means that your program, should it compile, has undefined
behavior. Name starting with _[A-Z] are reserved to the C/C++
implementation. We mere users must not declare such names in our code.
> #i
"jack" <[EMAIL PROTECTED]> writes:
> sorry,what is the smart point?can you give me an example?
It's "smart pointer", not "smart point". Smart pointer types are types
whose instances behave similarly to pointers, thanks to appropriate
operator overloading. As has already been posted, the Boost lib
Mike - EMAIL IGNORED <[EMAIL PROTECTED]> writes:
> To prevent the problem, I always follow
> a delete by clearing the pointer:
>
>delete [] a;
>a = 0;
>
> Your cout will then result in an immediate, and obvious
> crash, which can then be debugged.
IMHO, better advice would be to not expre
"jack" <[EMAIL PROTECTED]> writes:
> the following code can be run and can generate result:
> a[9]=10;
> what happend there?
Your program has undefined behavior.
What you are seeing is one instance of undefined behavior.
___
Help-gplusplus mailing list
Thomas <[EMAIL PROTECTED]> writes:
> I'm using the following
> char** m_pcPuzzle;
>
> to create an array for to store a crossword puzzle. I allocate memory
> using the next few lines
>
> //allocate memory for new map
> m_pcPuzzle=new char*[m_iWidth];
>
> for (int x=0;x m_pcPuzzle[x]=new cha
"martines" <[EMAIL PROTECTED]> writes:
> struct Simple {
> template
> void fun() {}
> template <> // *)
> void fun() {}// **)
> };
>
> Can anybody explain what is wrong with the first code and what is the
The explicit specialization has to be defined in
71 matches
Mail list logo