|
Fixing up warnings so others can better contribute
|
Reply to this subject
Start a new subject
 
Refresh page
Pages: 1
2
3
4
| Posted by |
Twisol
USA (2,229 posts) bio
|
| Date |
Reply #45 on Thu 16 Sep 2010 07:41 AM (UTC) [ quote
] Amended on Thu 16 Sep 2010 07:42 AM (UTC) by Twisol
|
| Message |
|
| Posted by |
Nick Gammon
Australia (18,770 posts) bio
Forum Administrator |
| Date |
Reply #46 on Thu 16 Sep 2010 07:43 AM (UTC) [ quote
] |
| Message |
Twisol said:
Just as a small note, but you have this:
#pragma warning (disable : 4800) // forcing value to bool 'true' or 'false' (performance warning)
I don't have the code in front of me right now, but if I understand correctly, the issue is assigning a numeric value to a bool variable? I believe I had removed that in my old branch altogether, and replaced 'b = i' with 'b = (i != 0)', which to my mind is more explicit anyways.
It can be reproduced like this:
BOOL a = TRUE;
bool b = a; // forcing value to bool 'true' or 'false' (performance warning)
Now given a BOOL (say, an argument to a function) I just can't come at doing this:
It's just ridiculous.
It would be like saying in Lua:
if a ~= false and a ~= nil then ...
Instead of:
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
| Posted by |
Nick Gammon
Australia (18,770 posts) bio
Forum Administrator |
| Date |
Reply #47 on Thu 16 Sep 2010 07:44 AM (UTC) [ quote
] |
| Message |
Twisol said:
Nick, your second revert reverted pretty much the entirety of Worstje's fixes branch. Just checking, was that intended?
Yes, I was trying to pull in just the one commit that he mentioned fixes a few of the last 7 warnings. Not the huge numbers of typecasts he did. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
| Posted by |
Twisol
USA (2,229 posts) bio
|
| Date |
Reply #48 on Thu 16 Sep 2010 07:45 AM (UTC) [ quote
] |
| Message |
| Ah. `git cherry-pick` is the way to go, I suppose. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | top |
|
| Posted by |
Twisol
USA (2,229 posts) bio
|
| Date |
Reply #49 on Thu 16 Sep 2010 07:48 AM (UTC) [ quote
] |
| Message |
Nick Gammon said: BOOL a = TRUE;
bool b = a; // forcing value to bool 'true' or 'false' (performance warning)
Now given a BOOL (say, an argument to a function) I just can't come at doing this:
It's just ridiculous.
It would be like saying in Lua:
if a ~= false and a ~= nil then ...
Instead of:
BOOL is a typedef for some kind of int type, since win32 was created when C had no explicit bool. The Lua analog, I suppose, would be:
if a and a ~= 0 then ... end
|
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | top |
|
| Posted by |
Worstje
Netherlands (867 posts) bio
|
| Date |
Reply #50 on Thu 16 Sep 2010 07:52 AM (UTC) [ quote
] |
| Message |
| Please don't forget my fix to ProcessPreviousLine.cpp at line 749. It has one of the surviving warnings still. (Not sure if you're getting that one on VC++6, so I figured I'd mention it.) | top |
|
| Posted by |
Nick Gammon
Australia (18,770 posts) bio
Forum Administrator |
| Date |
Reply #51 on Thu 16 Sep 2010 09:19 AM (UTC) [ quote
] |
| Message |
| Got it now, thanks. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
7,930 views.
This is page 4, subject is 4 pages long:
1
2
3
4
Reply to this subject
Start a new subject
 
Refresh page
top
Comments to:
Gammon Software support
Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )