| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Comments:
<0> with that crazy C if substitute, it goes like so ... <0> var ? /* if true */ : /* if false */; <0> is that correct> <0> s/>/? <0> I'm looking at a bit of code that says ... <0> arrayOfObjects[666] ? arrayOfObjects[666]->Method() : 0; <0> isn't that backwards? <1> return (planet == "earth") ? true : false; <2> kiwi that's a little redundant <2> oh, nevermind ;) <0> presumably std::string planet("earth"); <1> just a example of '? <2> yeah <2> earthworm that looks like an ugly way of doing T* t = vec[666]; if( t ) return t->Method(); else return 0; <0> well, that doesn't matter, but that matches what i said, so by that definition, the array example should bomb out all the time right? <2> bomb out?
<0> crash, dereference NULL <2> no <0> right you are <2> it should just be a little more verbose instead of trying to pack as much as possible into one line <0> i think it is deliberate :) <0> i would never right it like that, always use if, and always use == NULL <0> that is my preference anyway <2> I never use NULL <2> it's just 0 <0> but yes, you are right, the code won't crash, it's just confusing <2> and you don't need to include anything to know what 0 is <0> what's wrong with NULL? <0> i never do include anything, i thought it was a language feature <2> it's got to be included from somewhere, or you need to define it <2> no, it's not <0> is this some msvc/g++ standard byp***ing? <3> if (pointer) <3> or if (!pointer) <4> else.. <4> Nice. <2> nod <3> because, for one thing, they work with iterators, whereas == NULL doesn't <2> or pointer = 0; <3> no, <3> never <3> that's always false anyhow <2> i don't mean as a conditional <3> the IDIOM is if (something) {things are ok} <3> like if(somestream) <0> weird, i can do "main { char * wee = NULL; }" and run that through g++ and it will work, is g++ breaking the rules? <3> or if(someiterator) <3> likely, earthworm <2> earthworm try it with -pedantic and -ansi or whatever those switches are <0> does anyone know what header it is actually in? <3> g++ breaks rules all the time <3> what is in? <0> NULL <3> who cares <3> don't use it <0> that would mean killing an habit ... <2> it's really not important enough to warrant ALL_CAPS, anyway <3> good, kill the habit <0> hehe <0> i think msvc defines "null" as well, and maybe even colours it like a keyword, even worse (if memory serves) <5> it accepts "main { " ? without the () and return type? <0> oh come on <2> no, but it does color nullptr, which is a keyword in C++/CLI <0> YUY0x7 --set-pedantic="off" <0> :) <5> no, it does not color null, not when in native c++ <3> nope, neither null nor NULL <0> okay, bad memory then <5> earthworm, well i thought you were saying that it accepted that specific line of code <5> which is exactly what you said <0> nah, i thought people would get the drift <1> never ***ume <0> especially on IRC <3> we all know how to parse *** / u / me <0> well, i'll pack in using NULL then
<0> no major loss, 0 will do <3> what do you want the 0 for? <3> other than doing T* blah = 0; <0> just so its crystal clear to read <3> what's crystal clear to read? <0> if(p_blah == 0) ... <3> that's ****ed <3> if (p_blah) <3> or in your case <3> if (!p_blah) <3> AND it works with iterators etc <0> hmm <3> your ***umption that 0 is a meaningful value is so much hooey <3> while (cin >> something) <3> you don't so == 0 or != 0 there <3> s/so/do <0> fair enough mate, I'll try to kill that habit as well <0> an thoughts on the if(69 == variable) {} style btw? <0> somebody was on to me about that today, I always thought it read better the other way round <0> the idea of course if to help you if you type if(69 = variable) {} by mistake <3> well that way if you miss the 2nd = you get a compile error <0> s/if/is <3> instead of something that compiles but doesn't seem to make sense <0> do you write your tests that way around? <3> of course, have for years <0> reckon much to the readability argument? <3> what readability argument? <0> excuse the barrage of questions here ... i just thought the statements read better the other way around <3> it's likely the way you've used to them <1> both ways are easy to read <0> aye, probably is, somebody actually mandated the variable == constant way in our coding guidelines <0> on the grounds of readability, but i'll stop boring the channel with this ****e now anyway, sorry folks :) <6> what should I use to check if something is present or not in an input file? I.E. a number, inputted by the user. <7> how big is "short" in bits ? <5> thats platform dependent <2> why does it matter, Cloud99 ? <8> I think it depends on your os <7> the os is windows 2000 <2> why does it matter, Cloud99 ? <5> sizeof(short) * CHAR_BIT <7> i am trying to p*** a memmory address to a function <8> well he had actually platform <2> Cloud99 - so? <7> well the address is 2 bytes <7> i am guessing its getting chopped off <9> short is 16bits <2> why are you p***ing an address as an integer? <6> any ideas on my question? <7> its a function exported by a dll <7> to access parallel port <2> and maybe you should p*** the type that the function accepts <2> (I kinda doubt it accepts a short' <2> unless it's an address into some other address space <2> did you write this dll ? <7> no <7> i am just trying to use <7> it <2> so what does the function signature look like? <7> one sec <7> http://www.logix4u.net/inpout32.htm <3> the address is TWO bytes? how do you know? <7> all i know is that i need to write a byte into 0x39C to get a character to be sent over parallel cable <3> that won't work in windows <3> sorry <7> well the .dll is supposed to solve that problem <3> so, send the byte to the dll then. were's the problem? <7> it doesn't work as its supposed to <7> :) <3> then I guess the dll didn't solve the problem <6> so <6> 8brownie bits in a brownie byte? <10> hey - question - if i have a function hashing a bunch of bits using a CRC type function, would the fastest method be to open the file with filemapping? or use ReadFile with a normal buffer? <10> i am not necessarily hashing the entire file <3> hashing only part of the file seems almost pointless
Return to
#c++ or Go to some related
logs:
#javascript #MissKitten #mysql #linuxhelp #skype #MissKitten #AllNiteCafe #networking #linux #linux
|
|