« first day (23 days earlier)      last day (4911 days later) » 

9:00 AM
I need the operator== to be able to use the std::find function on a vector<XMLNode>
 
Get* is a non-const method
why is it a non-const method? it looks like it should be a const method
 
yes it just returns a string
it should be, just my stupidity i guess
 
does it modify the XMLNode?
 
nope not at all
just returns a string
 
then make it std::string GetNodeName() const;
and your problem disappears
 
9:02 AM
hehe :) indeed
so I guess if i have a getter like that it should always be const
 
yes
 
cool
 
jjj
hello .. guys
can i ask a question..
 
you already asked a question
 
jjj
why do i love C++?
 
9:04 AM
lol
 
jjj
hahahaha
@Reno ...answer the question..
 
J i dont know why you love C++ , i dont want to comment on your love affairs D:
 
jjj
ha ha ha
 
besides i see from your profile that you are cheating on C++ with javascript , vb and C#
 
jjj
it is a Serious question
cheating ..!!!
what do you mean
?!
 
9:12 AM
@jjj so how do you express your love to C++....
 
jjj
oh ...hahaha
 
you said you love c++ and you havent answered any C++ questions
 
why do linker errors keep baffling me?
 
jjj
because my work doesn't involve with C++
guys focus..we have a serious question
i am not joking around
 
@Tony why does int &x =10; gives compilation error?
 
9:17 AM
@novice_coder cause you can't use the address of operator and then assign a value to it
 
you chose your name well @novice_coder
 
@tina why? please elaborate
 
lol @novice_coder didn't see the int bit
then my last thing I said makes no sense
 
@Reno c++ is a poly-amorous^W^Wmulti-paradigm language; it's only cheating if you are hiding
 
@tina you didn't answer my question
 
9:20 AM
@Roger :D
 
@tina: who will use your class diagram?
 
@novice you cant assign a integer to a reference
a reference is supposed to refer to some variable
 
@tina: I am trying to guide you
@tina: figuring out who will use your diagram (even if it's just you) and how it will be used will tell you what you should include and how it should be presented
 
yeah me too
 
9:27 AM
"Do you agree that this message is offensive or spam? yes no" oh gee, I'm glad they included those buttons
 
should an include guard in a header not make sure that no matter where you include a header, that it doesn't get it included twice?
 
@tony yes that is always acceptable
 
@Tony: no, it should (you have to love negative questions)
 
Als
@Tony: that is the purpose of incluude gaurds isnt it?
 
so why does my compiler still complain something is defined twice
despite all include guards
 
9:28 AM
include guards have nothing to do with linking
are you getting a link error?
 
yes, operator== already defined in blah.obj
 
Als
@Tony: should be a linking error
 
so what type of errors do include guards prevent then?
if they don't prevent annoying linker errors
 
redeclaration and others
 
try compiling struct A {}; struct A {};
 
Als
9:30 AM
@Tony: you probably have 2 definitions for == and include gaurds can do nothing about it because include gaurds are in header and defiinitions are in cpp source files
 
sbi
@JamesMcNellis I specifically wrote "I had only scanned over last night's messages, and your reference to @Steve's comment caught my eye..."
 
@Tony you probably need to put definition of your == operator in your cpp / cc file
 
oh, not in the .h file?
 
only the declaration in the h file
 
in your experience developers from which country are good ? imo guys from scandinavian countries are just awesome
 
9:35 AM
@Tony: you can only define functions in a header if they are inline
@Tony: and note all functions defined within a class definition are implicitly inline
 
Als
@Tony: you probably have == defined in your blah.cpp as well as one of the headers, which causes multiple definitions
@Reno: depends .....
 
@Tony: if you define a non-inline function in any header, then every TU that includes that header will have a definition, and thus you get link errors
 
@Als on what ?
 
Als
@Reno: On ow fortunate one has been to work with gr8 programers
 
9:40 AM
tina: T isn't a class. It's whatever you pass as the template parameter to GetMax
 
i guess a lot of you have been overseas ... its just that ive seen that nordic developers think more clearly than others
 
GetMax<int> means T is an int. GetMax<long> means T is a long
 
tina read online about templates
 
@Reno: must be the cold air... or cold women?
 
I'm about to go overseas in a couple of hours
:D
 
9:41 AM
cool where (:
 
From UK to US (portland) for a two week business trip
 
Als
@Roger: Women and programers get alon well....not the women in testing though ;)
 
@Als are you kidding ? you cant deny the tension and chemistry between women in testing and developers lol
 
tina: it is like a macro, but a bit safer.
 
because you are not reading an article on templates
its difficult to explain it to you here , english is not your strong point
 
Als
9:47 AM
@Reno: No one can claim perfection in english unless english is your first language which is not for most of us
 
do you have access to youtube ? you will find a video on templates
 
Als
@Tina much better to read a book and then ask specific Q's not a broad concept
 
@Als i know , trying to explain something technical in english , & that too typed english is kinda awkward and you can end up confusing the other person
 
@RogerPate I just have this in my .h file 	friend bool operator==(const XMLNode & lhs, const XMLNode & rhs);
and the implementation in my .cpp file
 
i know how to speak her first language btw lol but that would be even more confusing
 
Als
9:52 AM
@Reno: seems Nihongo eh
 
@Tony: where is that op== defined?
 
inside the class defintion
 
@Tony: how long is that header?
 
67 lines
 
could you put it on codepad.org?
 
9:54 AM
the header only?
 
@Als she speaks hangul and urdu i believe
 
@Tony: that op== is not defined in the class definition, it is only declared (sometimes called a "forward declaration")
I'm talking about line 41, specifically
 
ok
so in my cpp file I have this:
bool operator ==(const XMLNode & lhs,const XMLNode & rhs)
{
	return (lhs.GetNodeName() == rhs.GetNodeName() &&
		lhs.GetNodeValue() == rhs.GetNodeValue());
}
 
when you get the multiple definition error, what locations are given?
 
in the XMLLib.lib
is the name of my project
 
9:58 AM
where else?
(it is a "multiple" definitions error, right?)
 
yeah ideally it should happen
 
"bool __cdecl XML::operator!=(class XML::XMLNode const &,class XML::XMLNode const &)" (??9XML@@YA_NABVXMLNode@0@0@Z) already defined in XMLLib.lib(XMLNode.obj)
 
it maybe here
#include <xercesc/dom/DOM.hpp>
#include <xercesc/dom/DOMElement.hpp>
 
@Reno I was wondering if that might be the issue
 
@Tony: what is being processed to give that error?
 
10:00 AM
my little test output project
where I test my classes
 
right, but which TU
I'm trying to figure out what TU and hence what file needs to be looked at for the other definition
 
TU?
 
@Tony you will fin the name the name of the other obj file before "bool __cdecl XML::operator!..."
check your build logs
 
(XMLDocument.obj)
 
10:06 AM
how long are XMLDocument.cpp and XMLNode.cpp?
 
XMLDocument.cpp = 400 lines
XMLNode = 138 lines
 
make sure yourself that XMLDocument.cpp doesn't define this op==, then put it on codepad and I'll take a look
going out for a bit, be back in about 30 mins to an hour
 
ok
 
@tina: please take the time to spell out words like "why"
you are not too fast; try harder
everyone appreciates it, and you are likely to get better and more responses; for the same reasons you dress up for a job interview instead of going unkempt
 
@Roger nice example
@tina .. yes you got it
 
10:29 AM
@tina what about it? do you mean inheriting a class, or have a member property of a class, that is it self another class?
 
no she means a class inside a class
its valid in c++
 
@Reno like I said, dose she mean inheritance or a member property that is a class. for some one who is new to C++ I can see them meaning the same thing by 'class inside a class'
 
@coshman never mind me then i need some sleep :)
 
@Reno fair does. I am fairly sure she does mean using a class as a member property, but I can still see inheritance being meant... terrible grammar that
@tina I would help explain to you, but I don't understand what it is you need explaining exactly
@tina ok... I shall assume you mean using a class like a member property like you would an int or a float
eg
class a{
}
class b{
a property;
}
class b has a member variable of type a
or do you mean inheritance?
class a{
}
class b: public a{
}
I know you mean for a UML diagram, but how to represent each case is diferant for UML
@tina you just don't do that. you do not define a class with in another class
to show inheritance, you use an arrow from the derived class that points to the base class. to show a member property that is of a type of another class, you do it just like you would for an int
@tina you would define class B then say that class A has a member of type B
you use a class just like you use any other type, just that you defined the class your self. types like int and float are defined by the C++ language it self
they are primitive types
@tina in this example, yes. it looks like you are trying to say that class A has a member that is of type class B
 
@coshman i loled at the mean girls reference :D
 
10:44 AM
you would write it like this
class MyFirstClass{
}
class MySecondClass{
MyFirstClass MemberVariableOfTypeMyFirstClass
}
@Reno where :S
 
im not taking it as a joke , no offense intended to you tina
 
no seriously, I just don't see where this giggle to be is?
any ways, I got to go for a bit
 
@coshman well it reminded me of something like this .. it a reference to the movie mean girls
 
@tina your welcome
 
i think its composition
 
10:50 AM
@tina yse, but you don't 'make' class B in class A. you define class B and class A, and when defining class A you say it has a property of type class B
@tina aggregation and composition... ergh UML tries to make them different things, and it sorts of imply deferring things, but when it comes to actually implementing them they are the same.
its some thing to do with how they are linked together. does class A collect / store / manage class B or does class A use class B to function it self... I think
@tina it could be composition, it depends more on how the two classes are used together... it gets rather fluffy and undefined here I think
remember that UML is not clear cut like C++ is
on the off chance you don't know, the STL already has a fine linked list ready for you to use
so unless this is just an exercise for fun, theirs not much point
your code also looks kind of confused
@tina a technical exercise?
I think this would be more of a composition... as the iterator owns the link nodes... I think... en.wikipedia.org/wiki/…
if in doubt wiki it :D
but like I said, this only matters for UML, in code they are more or less all the same
usually the only thing that matters is, dose class A have just one instance of class B or does it need to store an array of class B
k
 
11:24 AM
@Tony did you find it?
 
11:35 AM
I have failed to find it
it just stopped making sense to me
 
do a clean build; sometimes these errors are side-effects of a mis-configured build system
sometimes lemming answers really bother me. usually means I need a good, long break from SO ><
 
12:22 PM
*cough* *sputter* *choke* ... they changed google.com to have a ton of crap on it
 
12:50 PM
@RogerPate rebuild makes no difference
 
did you put XMLDocument.cpp on codepad and I missed it?
 
It seems the Japanese invented the PC. They had the PC-1 computer already in 1958... Based on a "parametron" circuit...
 
@RogerPate no I haven't, I will just a sec
@RogerPate please ignore any other mistakes... it is by no means complete yet
 
@tina: use @thecoshman to get his attention
 
12:55 PM
@tina sup?
going out in a bit I think... just waiting for the lady to finish sorting out stuff to post
 
@Tony: I don't see any operator overloads defined there, so it must be defined in a header included (directly or indirectly) by both that file and XMLNode.cpp (if I got that last filename right)
 
ok
that really sucks
 
@Tony: you've looked quite a bit, so if you have all the files in a zip or hg repo somewhere, I'd take a look
(my email address is on my SO profile, if you don't have a place to upload)
 
@RogerPate you want my project?
 
I'll see if I can't find this error for you, sure
 
1:07 PM
ok, so your email is that whole first line?
ok
you may remove that again, if you don't want it on the chat
 
probably a decent idea, though gmail's spam filter is great so far; (that one forwards to another address for just that reason ;)
 
hehe
it won't compile though if you don't have the libraries installed I'm using, does it matter?
 
we'll see :)
 
lol
 
hang on, I gotta apt-get install unrar
 
1:20 PM
lol
 
XMLNode.h, line 62
that's defining the function and it's not inline
 
so I have to make inline explicitly?
 
that would be the minimal change to make this correct
you could also move the definition to XMLNode.cpp
or move the definition to inside the class definition (where you declare op== as a friend), which makes it implicitly inline
 
yes inlining it explicitly produces no errors on build
wowµ
 
I note you left those lines out when you pasted earlier :)
 
1:26 PM
actually I had then put them in .cpp file
but it gave me errors too
 
well, hopefully you see the problem and understand why, now
 
so why does it need to be inline then?
i see the problem, yes, but why...
 
look up the ODR / One Definition Rule on wikipedia or elsewhere (though I recall that WP's definition has a few subtle problems)
the why is simply because that's how c++ works: non-inline functions can only be defined once in the entire program (across all TUs)
this is more historical than anything else, since you could conceivably make every function inline in order to define them in headers
but it is the way things are
 
@RogerPate thx a lot for the help :)
 
1:34 PM
you probably got sick at the look of my horrid code, haha
 
nah, didn't look at too much, just did some searching once I got it unrared :)
 
hehe
 
usually 80% of solving a problem is figuring out or knowing likely candidates for what it is
 
yea, well i have a 4 day weekend this week, so I'm gonna be reading my newly acquired C++ books
 
good man
 
1:45 PM
btw, can .obj file be opened in a dissassembler?
 
sure
 
its just asm right?
 
eh?
an object file contains quite a bit more, as it has to be linked and pass on things like debug info
 
right, ok
 
even a "final" executable will have pieces of code run automatically to fixup addresses, and this is without going into SOs/DLLs
 
1:49 PM
yea I understand that bit, just wasn't sure bout .obj files
 
don't forget LTO / Link-time Optimization, which is becoming all the rage :)
there's a general trend to treating C++ more like a module system, but we have all this old code that needs to be supported, too
and that trend will greatly complicate object files
compare to .Net assemblies or Python .pyc, if you're familiar
 
yea .NET is familiar territory to me....
 
2:23 PM
@RogerPate how many hours can you code before you need a break?
 
why do you think I'm on here so much? :)
 
lol
 
shrug 1-2 is plenty at a stretch
take a 15 minute walk, at least, at that point
 
I see, so its not just me that cannot code 8hrs straight
so I need to add an object into a vector but I cannot use smart pointers or by value, so I guess a reference or pointer is the only way right?
 
a vector cannot hold references
 
2:27 PM
@Tony Me, too. My brain needs a break.
 
why can't you use smart pointers?
if you can use dumb pointers, surely you can use smart pointers
2
 
It's easy once you know PHP.
 
I think we should reintroduce "C with classes" : C with classes is easy, while C++ is not
 
@RogerPate underlying library doesn't seem to like smart pointesr
C++ is so NOT like PHP, whoever says that has obviously not written enough C++ in their life
@RogerPate what language do you NOT know? I see you're home in Haskell too...
 
2:43 PM
@RogerPate : I think [here](http://stackoverflow.com/questions/4124271/stdvector-of-objects-and-const-correctness)

A& operator=(const A& assign)
{
*const_cast<int*> (&c)= assign.c;
return *this;
}

invokes UB because `If you cast away the constness of an object that has been explicitly declared as const, and attempt to modify it, the results are undefined.`

What do you say on this?
 
@prasoon: the UB is about original const, and in your case it's UB. More practically it doesn't make sense to have a const data member that's varying. And even more practically it doesn't make sense to define an assignment operator for such object, (even one that does nothing), because one reason people put in a const or reference data member is precisely to prohibit assignment.
 
@Tony I barely know any haskell
@PrasoonSaurav it depends on how *this was actually declared, e.g. A const obj (3); // const_cast on obj, even if it becomes *this, is UB
 
@RogerPate oh ok
 
@PrasoonSaurav: it may depend on c being a const member, technically, I don't know the intimates there
but effectively, *this matters more
 
3:02 PM
@Alf : Thanks for the information.

@Roger : But still in my code I am trying to cast away the const-ness of `c` which is not good.
 
@sbi I know; I was trying for the humorous/sarcastic response; sorry if it fell flat.
 
@PrasoonSaurav: yeah, I said in my comment it's a bad idea no matter what :)
 
sbi
@JamesMcNellis Sorry for missing this. Anyway, there weren't that many messages.
Wait.
That was your point, right?
<blush>
 
so who around here understands normalization, cause I just never got it
 
@sbi I don't know how many messages there were, really. I was just trying for humor :-)
 
3:13 PM
@Tony: first you remove redundancies, progressing to ever higher numbered normal forms, in order to get clarity. then you reintroduce redundancies in order to get efficiency. the point is that the redundancies you end up with (supporting efficiency) are not necessarily the same as the original ones (more or less arbitrary).
 
cool
 
3:38 PM
who's ever tried to solve a Heisenbug?
 
Why hasn't had to solve a heisenbug?
 
A friend named Wally tried, once. We still visit him in the asylum on holidays.
 
lol, Schrödinbug
 
@thecoshman: that would be a bug you can't reliably reproduce, a Heisenbug is where observing it (such as in a debugger or with extra instructions) changes the outcome
race conditions are often susceptible, for example
 
yer, I read the wiki article on them. the noob bug has got to be the most prevalent sort of bug
 

« first day (23 days earlier)      last day (4911 days later) »