@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8



Comments:

<0> XType & xxx() { XType x; XType *y=&x; return *y; }
<0> XType *a=&xxx();
<0> no, wrong example
<1> sk8ing: Won't work.
<0> I know
<0> it's just a wrong example
<0> here's the real code
<0> that doesn't work eather
<0> http://www.noidea128.org/sourcefiles/15928.html
<0> and I'm using it like that
<2> what's NullOffer?
<0> Offer * po=&Offers("safdlakjfkda")["somthing"]["somethingelse"];
<0> Offer NullOffer;
<3> line 28 looks horribly wrong
<0> why?
<4> Operator = should return a reference to this.



<3> an ***ignment operator returning a bool?
<0> for (xx="dsafads")
<0> is that so wrong?
<0> sorr
<0> sorry
<0> for [if (xxx="sfdsf") ]
<3> people usually use == for equality testing
<3> not =
<0> it's not equality testing
<2> what do you want to test?
<0> if it got initialised as it should
<0> if the string was parsed correctly
<3> sk8ing what the **** does this thing supposedly do?
<3> what's the difference between std::string and string
<0> none
<3> why the hell do you destroy all the RHS stuff on your operators
<5> error C3861: 'transform': identifier not found !!!
<2> you probably should do something like iostreams.. make it convertible to void* to check state
<3> #include <algorithm>
<5> ahh
<5> thx
<0> RHS?
<3> right hand side
<0> cuz I need it this way
<3> you actually change the rigfht side of = ?
<3> people are gonna kill you
<2> hehe, yeah and it wont allow you to do, if (xxx="sfdsf") either
<3> right
<3> so maybe you should re-consider your design
<0> nope
<0> I'm not changing it
<0> I use &
<3> fool
<3> then go away
<3> we're not going to try to salvage such a piece of ****
<0> so I won't lose time copying stuff
<3> that was the next question, why so many call by value for strings?
<2> sk8ing, p*** a T const&
<2> not a T&
<0> ok
<3> sk8ing what the hell are you using to try to learn C++ from?
<0> right now I'm just playing
<0> so what is the bad part about the design?
<0> I'm not changing the right part of =
<3> well go get some books and quit pestering us until you've learned at least a LITTLE of the language
<0> and I need bool as return from =
<0> cuz I'm doing some parsing
<3> then why isn't it a std::string const& ?
<0> if I would do operator = (Offers x)
<0> I would return this
<0> but since I'm doing it for a string
<5> do i need to do : string foo = transform(..., toupper); ?
<3> YOU stilll return *this from an ***ignment
<0> I need true as a return
<3> sk8ing you have NO ****ing idea what you're doing
<5> nvm
<3> NONE
<1> sk8ing: Sorry, but no, you don't.
<0> what do you mean I still return this?
<1> That's not how = works.
<3> operator = returns *this



<0> no matter what?
<1> x = y = a = b = c;
<3> unless you want to confuse everyone trying to use your stuff
<1> That's how = works.
<4> Operator = returns *this ebcasue that's what operator = means to everyone.
<0> hmm... ok I'll change the return type
<1> You can't learn C++ by playing around.
<3> and get some const correctness
<1> Because playing around doesn't teach you the right way to do things.
<1> It just encourages bad habits.
<0> I thought I can do that...
<0> in fact, it works, I didn't knew you'll shoot me for it :)
<4> sk8ing: If you need to check if everything went right, you can add a method for it. And after returning *this, call that method from that object.
<3> oh you can have all the bad habits you want, just expect to get yelled at in herre
<0> :D
<0> it's ok
<0> I'll change it
<2> some people like returning void from operator=, can't remember their reasons right now..
<6> you could also just throw an exception if it didnt go well
<3> what does bool has(std::string, std::string) do?
<6> and just ***ume it went well otherwise
<6> and have methods in the exception cl*** to evaluate reason for the failure
<4> tiocsti: WEll, it all depends if he expects frequent failures of that condition or not.
<3> and WHY don't you put meaningful names on your arguments so that people reading the header file know what the **** they are?
<0> it checks the vector ofrs if there's an element with cnt==string1 and cat==string2
<6> yeah i didnt look at what he's doing precisely
<3> you then why sin't the function const?
<0> I don't use to use const too much, I guess I'm gonna use it from now on
<4> sk8ing: You would benefit from reading http://www.parashift.com/c++-faq-lite/const-correctness.html
<3> and it's virtually certain that size_type size() const; is what you really want
<0> DrkMatter: thanks
<0> thanks again, I'll fix all this things
<3> btw, what ARE you trying to write?
<0> some kind of table, that will get serialized
<0> I don't have to ask the question :P
<0> I just realised why is my pointer pointig to something that does not exists :)
<0> my problem whas that Offer * po=&Offers("some serialized string")["safd"]["sdfd"];
<0> was pointing to something and that something wasn't there :P
<0> I'm so dumb
<6> sometimes i wish compilers had a switch whereby if you did not specify const or modify the data in the member function, that the compiler would fill it with random data
<0> It's because it get's destroyed after po is ***igned with the value...
<3> someday maybe I'llunderstand what that statement is SUPPOSED to mean
<6> ...to encourage const :)
<0> well Offers("safdas") will create an instance of cl*** Offers, deserializating that string
<4> sk8ing: You might want to add some brackets in there. o_O
<0> then the first [] returns a OfferRef
<0> and the second one applyes on the OfferRef and will return an Offer struct
<6> is this some sorta hash_map thing?
<3> and where one could use it
<0> well
<0> I have a mysql table with some stuff in it that represent single objects that contain theyr own table with stuff
<6> i mean the syntax looks like some sort of pair ***ociative container
<0> and that table is storred in a single field
<5> if i have a tab of string and hum its already full, and i just want to replace value tab[0][0]; Will a tab[0][0] = "new val"; do ?
<3> toast????
<5> well it does work :p
<6> a 2d table of char* pointers?
<3> ewwwwww
<3> but yes that will work
<7> 2d table of char* :S
<6> i might suggest strdup or something, so you can free all the pointers when the object is destroyed
<6> and so you can support stack allocated strings, and whatnot
<5> me ?
<6> yeah
<5> ya a table of char
<6> why the x and y axis?
<5> its a sudoku
<6> oh
<7> int main(int argc, char* argv[]), is there a way to change that so it puts each char* as a std::string into a vector? :)
<4> Why is Sudoku suddenly everywhere I look?
<3> threat no, but you can do it trivially
<7> vawjrwrk, yeah
<6> threat, iterate through args, ***igning each to a vector of std::string?


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #c++
or
Go to some related logs:

#AllNiteCafe
nicolae guta-smecherii fac ce vor
#linux
#MissKitten
Calligula, Incitatus
#gentoo
#linux
armani-Ghost at malta
#asm
#MissKitten



Home  |  disclaimer  |  contact  |  submit quotes