|
||
|
|
#1 (permalink) |
|
Guest
Posts: n/a
|
the first book is for C++, while it is the fourth edition it is still very very useful...
C++: The Complete Reference, 4th Edition (Paperback) by Herbert Schildt ISBN: 0072226803 Comments: thick book, good for tossing at people, but seriously, it's great for those who just want strait forward explanations on things and also references... excellent for those who are wanting to go ahead and just learn conventions. C: The Complete Reference, 4th Ed. (Paperback) by Herbert Schildt ISBN: 0072121246 Comments: same as above, but for C... couple this with the above and you got a solid understanding of C/C++ notes: 1) on both of these with how Micros**t does it's things they might nto work work 100% if your using C, but if you use Mingw32 you will be set. 2) these two books focus on general C/C++ programming but do not go into heavy details on standardized scripts... but it's still useful. |
|
|
|
#4 (permalink) |
|
Administrator
Join Date: Aug 2002
Location: Baltimore, MD
Age: 25
Posts: 4,845
|
Believe me I know all things C/C++... If you wanna know something other than books, just ask :-P
__________________
Zippy, Razor Creator and RunUO Core Developer The RunUO Software Team "Intuition, like a flash of lightning, lasts only for a second. It generally comes when one is tormented by a difficult decipherment and when one reviews in his mind the fruitless experiments already tried. Suddenly the light breaks through and one finds after a few minutes what previous days of labor were unable to reveal." ~The Cryptonomicon |
|
|
|
|
|
#5 (permalink) | |
|
Forum Expert
|
Quote:
Code:
#include <iostream>
using namespace std;
enum PeopleFlags {
None = 0x00,
HasCar = 0x01,
HasPet = 0x02,
HasWife = 0x04,
HasHouse = 0x08,
HasGarden = 0x10
};
int main()
{
PeopleFlags mask = (PeopleFlags)5;
cout << mask;
cin.get();
return 0;
}
Btw. sorry for a small thread-hijack :-/
__________________
|
|
|
|
|
|
|
#6 (permalink) |
|
Forum Expert
|
Essentially, enums are merely ints with a different type and that type is implicitly convertible to int but does not include a "conversion constructor" for int(which is why int i = None; works whereas PeopleFlags pf = 5; does not). Therefore it would make sense that you could assign any value that can fit in an int to an enum and have the enum hold that value, as it is only an abstracted int.
With that said, it makes sense that the conversion is applied between PeopleFlags and int is applied when you output it to stdout, as there is no operator << defined with right-hand parameter of PeopleFlags, and seeing as how all the conversion does is return the value held rather than the closest value defined in the enum (or some other such thing), 5 is output. Also, the values in the enum's definition are just that, values assigned to that identifier, not the only values that an object with type of the enum can hold, however they are one of the only things that can be assigned to an object of that enum without a cast. And, getting back to the thread's topic, if I were to recommend a core subset of books to read, I'd have to suggest For C: The C Programming Language by Brian W. Kerninghan and Dennis M. Ritchie For C++: The C++ Programming Language by Bjarne Stroustrup The C++ Standard Library : A Tutorial and Reference by Nicolai M. Jusuttis C++ Templates: The Complete Guide by Nicolai M. Josuttis and Daveed Vandevoorde C++ Primer by Stanley B. Lippman, Josée Lajoie and Barbara E. Moo Imperfect C++ by Matthew Wilson And other than those, I'd also recommend most of the books from the C++ In-Depth series as well as the Effictive * line of books by Scott Meyers. Other than that, practice, practice and more practice. Experience is the best teacher once you can grasp the basics. Last edited by Sep102; 12-20-2005 at 05:30 PM. |
|
|
|
|
|
#8 (permalink) |
|
Administrator
Join Date: Aug 2002
Location: Baltimore, MD
Age: 25
Posts: 4,845
|
Basically enums in C++ are just ints. Don't think of them as having any other special properties... they are just ints and they define constants. Depending on the compiler very little checking is done on enum types other than the checks for integers....
So something like Code:
enum Color { Blue, Red };
enum Size { Big, Small };
Color mycolor = Big;
Unlike C#, C/C++ compilers vary widely about exactly how they do things, even between compilers which are also ANSI.
__________________
Zippy, Razor Creator and RunUO Core Developer The RunUO Software Team "Intuition, like a flash of lightning, lasts only for a second. It generally comes when one is tormented by a difficult decipherment and when one reviews in his mind the fruitless experiments already tried. Suddenly the light breaks through and one finds after a few minutes what previous days of labor were unable to reveal." ~The Cryptonomicon |
|
|
|
|
|
#9 (permalink) | |
|
Forum Expert
|
Quote:
For example, enums (normally) have much more type information associated with them than they did in C, so there is a good chance that a C++ compiler (or C/C++ compiler compiling under C++) would not allow that statement at all or at the very least emit a warning that the two types are not exactly the same and it may not be what your intentions were. Last edited by Sep102; 12-26-2005 at 04:43 PM. |
|
|
|
|
|
|
#10 (permalink) |
|
Forum Newbie
Join Date: Jul 2004
Posts: 59
|
Exceptional C++ by Herb Sutter is a book for more advanced users of C++. It provides the does and don't of C++/STL, engineering designs and "safe" coding by presenting puzzles to the reader and then offers an in-dept solution and discussion of the problem/puzzle. It is very good reading.
The infamous GoF book, no developer should be without this in his repertoire. Design Patterns - Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. Another book you can't go without :- Modern C++ Design: Generic Programming and Design Patterns Applied By Andrei Alexandrescu A copy of the real C++ standard in hardback if you have spare cash lying around is probably a good investment too. Although you can find drafts of the standard online, it is more a vanity purchase than something you'd really use. Just something to say "Yeah I got that." UNIX Network Programming Volumes by Richard Stevens if you can afford it and are network inclined (although might be a bit dated) Donald E. Knuth, The Art of Computer Programming (one of the classics) again very expense since it encompases loads of volumes. Algorithms by Robert Sedgewick is a pretty good algorithms book too. The one I'm currently reading which is also a good read. Refactoring: Improving the Design of Existing Code by Martin Fowler. For C, "The C programming language" - the famous "K&R" book so many C programmers swear by. Again really a vanity purchase but good if you want to learn C. Make sure to get the latest edition though or else you'll be programming from C like they did 20 years ago ;/ That's all I can think of the moment :> Last edited by xir; 01-08-2006 at 04:21 PM. |
|
|
|
|
|
#12 (permalink) |
|
ConnectUO Creator
Join Date: Jan 2004
Location: In your mom
Age: 27
Posts: 4,762
|
WIN32API = easy
MSDN tells all about it and how to use it with great explinations ![]()
__________________
Jeff Boulanger ConnectUO - Core Developer Want to help make ConnectUO better? Click here to submit your ideas/requests Use your talent to compete against other community members in RunUO hosted coding competitions If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team. Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO |
|
|
|
|
|
#13 (permalink) | |
|
Join Date: Aug 2005
Location: Woodward, OK
Age: 34
Posts: 67
|
Quote:
I'm using Visual C++ Express I've created a DLL for a global hook I've tried this with both the GetMessage hook and the standard Mouse hook In both cases I'm met with the same results. I'm simply trying to catch when someone right clicks on a forms minimize button. Naturally I'm watching for the WM_NCRBUTTONUP message to accomplish this. What happens is truly odd indeed. When the hooks are in place the hook doesn't trigger properly when I click the minimize button. If I click dead center or to the left of dead center on the minimze button with my right mouse button I get a system menu. If I click to the right of dead center over almost to the right border of the minimize button then my hook triggers properly but only far over to the right edge of the button. I've tested this with the maximize button and close button and they both function properly. Also if I use the left mouse button on my minimize button everything performs as expected. The only time this happens is in MY code and with the RIGHT MOUSE button. Got any ideas? I can attach my projects if you need them. |
|
|
|
|
|
|
#14 (permalink) | |
|
ConnectUO Creator
Join Date: Jan 2004
Location: In your mom
Age: 27
Posts: 4,762
|
Quote:
, i just know the WIN32API from C# You should start another thread asking for help here tho, im sure someone will come along who can help ![]()
__________________
Jeff Boulanger ConnectUO - Core Developer Want to help make ConnectUO better? Click here to submit your ideas/requests Use your talent to compete against other community members in RunUO hosted coding competitions If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team. Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|