![]() |
| | #1 | |
| mov.w #$1337,D0 Join Date: Nov 2001
Posts: 704
| Compiler "Warnings" As far as I've been concerned I've always considered compile warnings to be like "Hey, if you don't know what you're doing this could **** you up.." Of course I've always known what I was doing so I found them to be rediculous nagging. So I am asking you, if you compile your programs, works exactly as intended, passes test cases out the wazoo, do you continue to modify the code eliminating "Warnings" ? If you are curious, this is the list of warnings from my latest program. I'm not asking for help, I'm just asking for personal opinions. Quote:
__________________ c++->visualc++->directx->opengl->c++; (it should be realized my posts are all in a light hearted manner. And should not be taken offense to.) | |
| Jeremy G is offline | |
| | #2 |
| Bob Dole for '08 Join Date: Sep 2004
Posts: 618
| those warnings could cause memory problems... leaks, miss-assignments, etc. Something you probably dont see while doing tests on the program.
__________________ Hmm |
| B0bDole is offline | |
| | #3 |
| Rad Join Date: Mar 2003
Posts: 942
| Yeah. Those kinds of warnings make programs like Windows come to pass. [/WindowsBash]
__________________ -Stephen Cope smc42190@gmail.com http://purevolume.com/step http://myspace.com/stephencope |
| gcn_zelda is offline | |
| | #4 |
| mov.w #$1337,D0 Join Date: Nov 2001
Posts: 704
| Both of you were probably right. Those warnings were actually pretty serious. And I've completely eliminated them. How ever, some warnings are just superflous.
__________________ c++->visualc++->directx->opengl->c++; (it should be realized my posts are all in a light hearted manner. And should not be taken offense to.) |
| Jeremy G is offline | |
| | #5 |
| Registered User Join Date: May 2003
Posts: 2,787
| not really... the way I see it, you should try to minimize warnings by as much as possible... when I'm getting a warning, I find out what it means and if/how I can get rid of it. the standards were drawn up for a reason--there are reasons for every one of the warnings you get. it's not like they just said "let's throw this warning in there just for kicks". I agree--you can compile and run a program with no problems if you don't explicitly cast a float to an integer, but that doesn't help the readability of the code, and it may actually remind you that you're going to be losing data there...
__________________ Join is in our Unofficial Cprog IRC channel Server: irc.phoenixradio.org Channel: #Tech Team Cprog Folding@Home: Team #43476 Download it Here Detailed Stats Here More Detailed Stats 52 Members so far, are YOU a member? Current team score: 1223226 (ranked 374 of 45152) The CBoard team is doing better than 99.16% of the other teams Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374) Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT |
| major_small is offline | |
| | #6 | |
| the hat of redundancy hat Join Date: Aug 2001 Location: Hannover, Germany
Posts: 2,767
| Quote:
__________________ hth -nv She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate." When in doubt, read the FAQ. Then ask a smart question. | |
| nvoigt is offline | |
| | #7 |
| and the hat of Jobseeking Join Date: Aug 2001 Location: The edge of the known universe
Posts: 21,630
| > gcc -o main.c main.exe OMG!!! So you want to OVERWRITE your source file with the compiled code? Be more careful with your commands man, otherwise you'll be in the same position as another poor sap who managed to trash all his code a couple of hours before the "deadline". It's a good job the command line was invalid as well, otherwise you'd be scrabbling round for a backup (you do have backups right?) |
| Salem is offline | |
| | #8 |
| vae victus! Join Date: Nov 2003
Posts: 594
| The superflous warnings you're talking about are probably like "unsigned being compared against signed value" or "float to int conversion, possible loss of data." For most pieces of data they won't matter, but they could come to bite you in the arse. |
| skorman00 is offline | |
| | #9 |
| Senior Member Join Date: Nov 2002 Location: Phildelphia, PA
Posts: 1,146
| The most superfluous warnings I've received were from Visual Studio 6.0 telling me that I had identifiers that were too long. I wasn't personally using 300-character identifiers. The problem is that a vector of strings expands out to an identifier of obscene length explictly stating the type of character set being used and the allocator that the vector is using and so on. Eleven warnings every compile like that, but not a single problem caused by it in testing, so meh. By the way, has anyone else ever run into that problem? |
| joshdick is offline | |
| | #10 |
| vae victus! Join Date: Nov 2003
Posts: 594
| I know a buddy who swears by long and descriptive function/variable names. He'd come up with something like Code: TakeTheXValueAndCalculateTheCorrectYValue(int thisIsTheXThatIsUsedToComputeTheY) I'm going to poke fun at him now with this, thanks joshdick. Some of you fellas/ladies may have already seen this, but it's always worth a second look. http://www.effect.net.au/lukastan/hu...ssages-Mac.htm |
| skorman00 is offline | |
| | #11 | |
| Anti-Poster Join Date: Feb 2002
Posts: 1,223
| Quote:
The warning I'm working on eliminating right now at work involves the STL containers not having dll-interfaces. I don't think it's a problem, but it'd be nice not have 22 warnings every build.
__________________ Rule #1: Every rule has exceptions | |
| pianorain is offline | |
| | #12 | |
| Senior Member Join Date: Nov 2002 Location: Phildelphia, PA
Posts: 1,146
| Quote:
| |
| joshdick is offline | |
| | #13 | |
| mov.w #$1337,D0 Join Date: Nov 2001
Posts: 704
| Quote:
I use MSVC++. I copied this from some one who compiled my program with gcc for me to find out if there would be more/less warnings depending on compiler.
__________________ c++->visualc++->directx->opengl->c++; (it should be realized my posts are all in a light hearted manner. And should not be taken offense to.) | |
| Jeremy G is offline | |
| | #14 | |
| Registered User Join Date: May 2003
Posts: 2,787
| Quote:
__________________ Join is in our Unofficial Cprog IRC channel Server: irc.phoenixradio.org Channel: #Tech Team Cprog Folding@Home: Team #43476 Download it Here Detailed Stats Here More Detailed Stats 52 Members so far, are YOU a member? Current team score: 1223226 (ranked 374 of 45152) The CBoard team is doing better than 99.16% of the other teams Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374) Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT | |
| major_small is offline | |
| | #15 |
| Peace Join Date: Aug 2001
Posts: 1,512
| WARNING: The following advice could be devastating in the hands of even a moderate coder. I must stress that 99.9% of warnings are valid and are possible sources of trouble. /WARNING You could always use the warning specifier to remove specific undesirable warnings. I prefer to enable my compilers "warnings as errors" option, but should you be an experienced programmer you may safely be able to use the warning specifier. #pragma warning ( disable, 4244 ) which would disable the "conversion from float to int, possible loss of data" warning. Or even better: You can push and pop the warning state around the code that generates undesired warnings, and udjust the warning settings solely for that code or file. Check it out. Peace |
| lightatdawn is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| added start menu crashes game | avgprogamerjoe | Game Programming | 6 | 08-29-2007 01:30 PM |
| Compiler Paths... | Cobra | C++ Programming | 5 | 09-26-2006 04:04 AM |
| C Compiler and stuff | pal1ndr0me | C Programming | 10 | 07-21-2006 11:07 AM |
| I can't get this new compiler to work. | Loduwijk | C++ Programming | 7 | 03-29-2006 06:42 AM |
| how to call a compiler? | castlelight | C Programming | 3 | 11-22-2005 11:28 AM |