@# 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 9 10 11 12



Comments:

<0> I see
<1> threat: In C++, ALWAYS prefer creating the variable at or as near as possible to the first use.
<2> your use of infile.eof() is also wrong
<0> I will refactor my style then :)
<1> Indeed. Read...
<2> !eof = while (!file.eof()) { file >> x; process(x); } // WRONG. file.eof() indicates FAILURE due to EOF. If file >> x fails due to EOF, process(x) won't have an x to process. And if it fails for some other reason (e.g. bad input), this loop may never end. Try { while (file >> x) process(x); } instead. See also: http://www.gnomesane.net/code/doc/noteof/
<1> http://www.parashift.com/c++-faq-lite/input-output.html
<1> That
<1> Or his link
<2> oh, you do the input first and then *duplicate* the same code 15 lines later, that's just about as bad as using eof() wrong
<1> And this isn't a matter of coding style.
<0> Kniht, there is nothing wrong with while(!file.eof()) as before I enter the while I extract from the ifstream
<1> This is a practical recommendation about the variables.
<2> see, even over 15 lines it wasn't obvious that the code was duplicated and correct
<1> A critical recommendation, really, where performance is concerned.
<2> there's everything wrong



<0> Solamente, I was taught that at uni :S
<2> what if one of those inputs changes?
<2> maintenance nightmare
<1> And the uni was wrong
<0> Kniht, ok thanx
<0> :)
<0> Solamente, I relise that
<1> We say that *ALL THE TIME*
<2> teach = Those who can -- do. Those who can't -- teach. Those who cannot teach -- administrate.
<0> true
<2> you also don't need to call close on the fstreams
<0> while (file >> x) process(x) what if I need to file >> x and file >> y ?
<2> while ( file >> x >> y ) process( x, y );
<0> Kniht, I dont? oh you are counting on the destructors to clean that up ?
<1> They will.
<0> ok
<2> that's what dtors are for
<1> The only way they won't be called is if you terminate the application abnormally or unplug your computer.
<0> and >> will get rid of ' ' and '\n' (or set the ios::pos thingy past it) ?
<1> Any other programmatic exit from the function will call the destructors.
<2> before every formatted input the istream should skip any leading whitespace, if the skipws flag is set (and it is by default)
<2> if it isn't, you can always use std::ws
<2> file >> std::ws >> x >> std::ws >> y
<2> Solamente: they would just apply the same (incorrect) principles to another language
<0> grrr well the only problem is I have been taught how to do it one way, and if I do it another way that the markers are unaware of I will loose marks
<1> Yeah, but the damage would be limited to Java, which ***umes you're stupid to begin with.
<0> so I guess I will learn how to program after I have my piece of paper ;P
<2> you mean they don't know c++?
<2> is it a c++ course? or random-language-invented-by-your-uni course?
<0> Kniht, they do, but they have different styles, and dont mind the while(!file.eof()) type
<0> Kniht, C++
<1> threat, that's not a STYLE
<1> That's INCORRECT
<1> There's a huge difference.
<0> Solamente, IT WORKS! :)
<2> I once had to argue with a professor about char* p = something(); if ( !p ) {}
<2> (I won)
<1> No, IT DOESN'T
<1> How many times can I say it?
<1> How many links would you like backing that up?
<0> IT DOES!! if you extract something from it too, hey you may have repeated code but at least I dont loose a mark over it :)
<1> threat, learn this, because it's crucial:
<0> ok
<2> and all that matters is that piece of paper, not whether you can program or not
<1> Just because some code doesn't die on a particular run or in a particular application does NOT mean that the code is correct.
<2> threat: do you know how much of a real project is spent maintaining existing code compared to writing new code?
<1> Let me repeat that...
<0> well I would like to beable to program proper
<3> Solamente: if "works" means "full marks" then it might actually "work".
<1> Just because some code doesn't die on a particular run or in a particular application does NOT mean that the code is correct.
<0> but thats useless if I dont have a peioce of paper to back it up
<3> Otherwise, that "style" is plain wrong.
<1> And testing against .eof() is plain wrong.
<1> Wrong.
<1> That means, it is the incorrect way of reading to the last bit of data in a file.
<2> threat: no it isn't, you can still get a job, but without learning to program yet having the paper will make you lose your job quick enough
<1> Have I made myself clear yet?
<0> Solamente, although isnt while(inFIle >> var); testing against eof()? or any other failure?
<1> threat, no.



<2> testing against eof isn't wrong, testing against eof before doing input and then using the input *is* wrong :P
<1> That's what I'm saying.
<0> Kniht, like I was saying, I am aware of the issues with using !infile.eof() but I have overcome that byu a previous line, whch makes it correct :)
<0> perhaps not maintainable, buyt correct! :)
<2> no, it makes it marginal
<3> testing against eof() for the loop is also wrong.
<1> No, you haven't.
<1> I wish I were a student again so I'd know everything.
<1> Being a professional ****s that way.
<4> hi there. what does "a ^= b" mean? "a = a or b" ?
<1> a = a XOR b
<4> xor
<4> thanks
<0> hmm so I never need to use the inFile.close(); outFile.close(); functions?
<2> they're still needed, but rarely
<0> Kniht, I have been taught to use them when I no longer need the stream
<0> to use .close() even
<2> if you don't need the stream, don't use the stream. better yet, put it in a scope so that it doesn't even exist once you don't need it
<0> Kniht, I hate the printSquare() function!! --> http://pastebin.com/535045
<0> Kniht, I cannot figure out how to do this
<5> morn
<0> evening
<6> !seen a
<6> #
<7> Hey everybody....I don't suppose there's someone here who might be able to sort through some code and help me out with something?
<7> is anybody alive in here?
<8> user[1], i'm alive
<8> =)
<7> Well, it does say just ask so I was asking. But about posting the code at the website - there's about 200-some files of code so that would be pointless doing it that way
<7> hence the asking part
<8> well i bet all those 200 files aint got a problem =)
<7> none of them have any problems i'm running into.... i'm just trying to add functionality to 1 of them, but it will call on several functions from the other files :)
<5> nd the problem is?
<5> did you make all the code/
<7> nope it's something from sourceforge.net
<7> poker-eval-128.0
<8> well declare the function@a header file, define it @a .c/.cpp file. Include the *.h file in the files that needs to call that function, bam done.
<5> so basically you want us to alter an existing project you did nothing with
<5> so the question is not a c++ question a all
<5> it is a *request for development*
<5> we have great hourly rates ;)
<7> *sigh* Tamama no, I wanted help understanding a function built into the program
<7> it wouldnt really help me to have someone do it for me, because I'm going to have to do a lot of changes to it later
<5> you didnt ask that
<7> i havent asked anything yet
<8> then just paste that function you want help understanding, and i'm sure
<8> one of us will be able to help you understand it.
<7> *nod*
<8> (@pastebin ofc)
<9> Hi
<9> Do you know a good page, that describes the filestructure of mp3 ?
<8> http://www.multiweb.cz/twoinches/MP3inside.htm , might be something for you
<8> did one google search, first link =)
<9> oh. what was your seach topic, since "mp3" would not give a reasonable answer in ggole :)
<8> mp3 file structure
<10> jascha, you might be interested in wotsit.org
<9> maybe I can ask directly: Has Mp3 a constant datarate, so I can find a time position in bytes by multiplying seconds*bytes?
<5> read the link Nott just pasted
<5> it has that info
<5> (short answer: not always)
<9> ok thx
<8> wotsit.org as cn28h said, had very good information for mp3.
<8> Will so add that site to favorites.
<9> i did :)
<9> How nice is this: "Each frame has constant time length 0.026 sec" :)))))
<5> unfortunately that does not equal constant byte size
<5> even in CBR
<9> theres written that CBR has only variations of 1-2 bytes each frame. Thats acceptable...
<0> user[1]++;
<5> hm interesting
<5> i think it is time for a compiler upgrade.. heh


Name:

Comments:

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






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

#php
#london
#linux
nerecode
paul
You must accept Sun's EULA prior to successfully installing this package
#linuxhelp
quotes for Maids of Honnor
reinstalling php5 with mysql support centosplus
ubuntu argentina mt810



Home  |  disclaimer  |  contact  |  submit quotes