| |
| |
| |
|
Page: 1 2 3 4 5 6
Comments:
<0> I don't think you're being imaginative enough. Why not make all types default constructed, and make "null" a mystical instance of the type? That would fix it too, right? :p <1> sirfloyd: you should work on understanding a singular pointer before worrying about arrays of them <2> pointer means reference to some variable am i rite ? <1> Rethguals: eh, maybe I'm not being imaginative... how do you invison the ideal alnguage working? does it have pink unicorns? :P <1> sirfloyd: no.... reference means reference to some variable. <1> T& t(c); // `t' is a reference to `c' <1> pointers and references are not the same thing. <0> Xiph: What accent has the ideal human? <1> Rethguals: I don't think that's a fair analogy :P <0> The point is that I'm not on a quest for some idea of perfection. <2> sorry i'm a novice <1> I think most of the time in most programs you don't care about the potential for pointers to be null, and would rather they could not be <1> ah, well, I'm not either. that's why I'm only suggesting an incremental change <2> any simpler explanation <1> your comment about me being not imaginative implied to me that you want some sort of greater improvement than what I'm suggesting =P <1> sirfloyd: simpler than what?
<3> sorry sirfloyd, you should probably read a book. try http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html it's free <2> ok thz <2> sorry <0> Xiph: no, I was only pointing out that you were preventing uses of null pointers when a smaller change is to prevent null pointers. <1> in order for something to be simpler than another thing, that other thing has to exist. your comment about pointers being exceptions is wrong, so I wouldn't say you could compare other explanations to it in terms of simplicity :P <0> I don't understand that sentence at all. <1> I was talking to sirfloyd <2> it's ok xiphoris <3> s/exceptions/references/; <1> He was saying he wanted a simpler explanation than "a pointer is a reference to an object" :P <0> sirfloyd. You live in a house, I imagine. <0> That house has an address. <1> Rethguals: but if everything's default constructed you lose the ability to separate construction from creation of the variable... perhaps you want to construct it one of two possible ways depending on a condition <0> You can tell someone that address, but it doesn't mean you've given them a copy of your house. <1> nullable types are useful for the same reasons that pointers are useful.... you just don't want to use them most of the time <0> Similarly, a pointer contains the address of an object, which is where your data live <2> ok.thz <1> hmm <1> Rethguals: is it common in the UK to say things like "Microsoft are doing X"? <1> almost always in US we would say "Microsoft is doing X". the former sounds weird to me, and I seem to hear it a lot from British or British news sources <0> It depends on X. We normally avoid generic verbs like be and do. <3> Microsoft is singular <1> I'm referring to "are" vs "is" <1> octogone: technically you can refer to a collective verb either way. <1> they're both gramatically correct, from everything I know. one sounds weird though :) <1> grammatically* <0> I think of a company as plural. I think I once got told off by my English teacher for it, though. <3> Microsoft is a noun. "collective verb"? <1> octogone: refering to it in plural means you're referring to the entities that compose it <1> i.e., saying "Microsoft are entering a new market" implies you mean "The people at Microsoft are entering a new market" or something. <1> I have an 800 SAT english, so you bettah respect, boi ;] <4> even MY grammar isnt that bad <1> it's valid grammar.... just Chiefly British :P <3> well, language evolves. your SAT score might be out of date ;) <1> yeah, it's evolving out of usage, at least in the US <1> but i hear it all the time on BBC or whatnot <1> example: http://news.bbc.co.uk/1/hi/technology/4088702.stm <1> "Microsoft are obviously bowing to political pressure to protect their investments" <1> google for "Microsoft are" <1> another site has "The conclusions are that there is no doubt that Microsoft are using open source in their products, that they are not afraid to show it, and that they are ..." <3> i'd vote to eliminate that language "feature" <1> so would I :) <3> gentlemen, this is precisely the kind of english up with which i will not put. <1> haha <1> I agree with you about ignoring that grammar rule. <1> I think it's stupid and clumsy to require sentences not to end with prepositions.. <5> if many fluent, articulate, educated speakers of a language find some rule to be clumsy or annoying, the language is wrong, not the speakers.. <5> afk <6> hi <3> 4 lines and still no content. hello <6> have little question, if anybody can help with it <6> is there way to create refference to constructor of cl***? <7> unfortunately, no. you can have a "forwarding method" call a constructor. e.g. Foo * Foo::create() { return new Foo; } <0> ...which can be static <6> hmm. it's interesting <6> thanx <7> er.. should be static, yes <6> agm.. and is there way to use syntax like void *type = { return new fireball(); }; <4> fire bad! FIRE BAD! <6> sorry for stupid question. ilong time used perl
<6> =) <6> for such usage it's necessary to declare function? <0> If you remove the 'return' that will compile. The braces are optional, too. <7> hey guys. ahh, you know it's funny: these people they go to sleep - they think everything's fine, everything's good. then they wake up the next day and they're on fire <0> It kinda depends what you're trying to do. <6> hmm <6> yep, it do <6> i wont to create array of constructors of different cl***es <7> are you trying to create an anonymous hash, |TEHb|? <4> octothorpe i hate when that happens <7> are you sure you want an array? maybe a map or a hash_map (or the tr1 equivilent) might make more sense <0> Tehb, what do you mean an "array of constructors" and what do you think that code does? <7> something like this perhaps? PRODUCT * construct_product(const PolymorphID & cl***_id) { return find_product_creator(cl***_id)->construct(); } <6> yep <6> octothorpe> something like that, i think <7> where find_product_creator() returns a value from a std::map<PolymorphID, CREATOR_INTERFACE *> and CREATOR_INTERFACE is a (usually) derived cl*** with a method called construct() which returns a derived PRODUCT *? <7> construct(), of course, being the method with the call to "new" <0> You might find "template<cl*** T> T* construct() { return new T(); }" a handy function to have. <6> thanx alot <6> it's time to think some. <6> i wont to make some code that can find cl*** constructor by that's name, definedas char * <6> so thanx alot i will think about it <7> typedef char * PolymorphID; <0> Bzzt. <7> er. that doesn't copy well. use std::string with containers instead <0> It doesn't compare well without a predicate. <7> ahh, right <6> okay. i understood =) <6> thanx a lot <6> maybe it's one more stupid question, but how to create refference on function? <7> http://www.google.ca/search?q=c%2B%2B+function+pointer <4> %2B or not %2B <8> lol <7> cute :P <9> That is the %3F <9> Canadian Google, eh? <7> it's the default for my firefox search bar <9> Does it replace "I'm Feeling Lucky" as "Feelin' Lucky eh?" <10> double generate3Perm(const int& truei, const int& truej) <10> would that be faster than <10> double generate3Perm(int truei, int truej) <9> no <9> they're the same <9> const is a compile-time directive <9> not a runtime optimization <7> no, because you'll be wasting time dereferencing the references (if not optimized) in the function <9> and being by reference shouldn't really matter. <10> Your function generate3Perm p***es ints <10> by const references. P***ing them by values <10> would run faster and lead to simpler code <9> and may actually slow it down from dereferencing, though minesculy <10> that's from my professor <9> well he's a douchebag <10> hahaha <9> look at the ***embly output of each one <9> and see <7> your professor is stupid. sizeof(int) is not greater than sizeof(const int &) <9> dereferencing an int will add two instructions to the output <9> and const is a compiler-only directive and has no bearing at all on runtime or ***embly code generation <0> Frankly, I agree with the professor. <11> me too, most of the times <10> how so Rethguals? <9> er, <7> eh? <9> right, nevermind duh <9> **** I read it backwards, the professor is right, for the reasons I stated above <9> haha <7> lol <7> s/your professor/you/; <9> p***ing by value is faster than by reference <9> yeah <9> you is stupid <9> :P <7> hahahaha
Return to
#c++ or Go to some related
logs:
#kl papolar #chat-world netcafe shots rawalpindi #kl #allnitecafe #vb #allnitecafe #kl rajiv pai
|
|