Valhalla Legends Archive

Programming => General Programming => Topic started by: Crypticflare on May 17, 2003, 07:25 AM

Title: Starting my journey through the lands of C++!
Post by: Crypticflare on May 17, 2003, 07:25 AM
So far all I've read of it was the first  3-4 chapters, but I must say I'm really enjoying it, with VB I was like "bah another chapter to read", but this stuff seems real cool. So uh thank you (All of the board members) that have given advice over the few months I been here! I'll be gladly posting questions that confuse me soon!
Title: Re:Starting my journey through the lands of C++!
Post by: drake on May 18, 2003, 07:08 PM
wait until you see how much faster C++ programs run too. Yet you will still end up with like 20 errors and 60 warnings during compiles.
Title: Re:Starting my journey through the lands of C++!
Post by: Yoni on May 18, 2003, 07:45 PM
I doubt it'll run any faster if the compiler encounters 20 errors and 60 warnings.
Title: Re:Starting my journey through the lands of C++!
Post by: iago on May 19, 2003, 12:47 AM
Maybe if you just delete the 20 lines that have errors on them and leave the other 60 lines intact then life will be good..?
Title: Re:Starting my journey through the lands of C++!
Post by: drake on May 19, 2003, 01:37 AM
I like my technique. I just say F it and stop working on it all together when I get too many errors.
Title: Re:Starting my journey through the lands of C++!
Post by: Noodlez on May 19, 2003, 01:56 AM
Quote from: drake on May 19, 2003, 01:37 AM
I like my technique. I just say F it and stop working on it all together when I get too many errors.
What an excellent way to waste time, and not learn a damn thing.
Title: Re:Starting my journey through the lands of C++!
Post by: Zakath on May 19, 2003, 12:41 PM
Indeed. Warnings are warnings - they are an attempt to let you know that something may go wrong. However, it's not always necessary to listen to them. On the other hand, errors must be fixed, and it's really not very hard to fix them.

Quote------ Build started: Project: ZakBot1, Configuration: Release Win32 ------

Compiling...
ZakBot.cpp
ZakBot.cpp(96) : warning C4244: 'return' : conversion from 'WPARAM' to 'int', possible loss of data
ZakBot.cpp(105) : warning C4311: 'type cast' : pointer truncation from 'LRESULT (__stdcall *)(HWND,UINT,WPARAM,LPARAM)' to 'long'
ZakBot.cpp(105) : warning C4312: 'type cast' : conversion from 'LONG' to 'WNDPROC' of greater size
ZakBot.cpp(141) : warning C4311: 'type cast' : pointer truncation from 'HBRUSH' to 'BOOL'
ZakBot.cpp(146) : warning C4311: 'type cast' : pointer truncation from 'HBRUSH' to 'BOOL'
ZakBot.cpp(151) : warning C4311: 'type cast' : pointer truncation from 'HBRUSH' to 'BOOL'
ZakBot.cpp(413) : warning C4267: 'argument' : conversion from 'size_t' to 'DWORD', possible loss of data
ZakBot.cpp(416) : warning C4267: 'argument' : conversion from 'size_t' to 'DWORD', possible loss of data
ZakBot.cpp(419) : warning C4267: 'argument' : conversion from 'size_t' to 'DWORD', possible loss of data
ZakBot.cpp(422) : warning C4267: 'argument' : conversion from 'size_t' to 'DWORD', possible loss of data
ZakBot.cpp(425) : warning C4267: 'argument' : conversion from 'size_t' to 'DWORD', possible loss of data
ZakBot.cpp(428) : warning C4267: 'argument' : conversion from 'size_t' to 'DWORD', possible loss of data
ZakBot.cpp(441) : warning C4267: 'argument' : conversion from 'size_t' to 'DWORD', possible loss of data
ZakBot.cpp(551) : warning C4244: 'initializing' : conversion from 'LRESULT' to 'int', possible loss of data

Build log was saved
ZakBot1 - 0 error(s), 14 warning(s)


---------------------- Done ----------------------

   Build: 1 succeeded, 0 failed, 0 skipped

A fair number of warnings, but none of them affect the functionality of the program (that's not to say those particular warnings should always be ignored!).
Title: Re:Starting my journey through the lands of C++!
Post by: drake on May 19, 2003, 09:30 PM
well I was joking...
Title: Re:Starting my journey through the lands of C++!
Post by: iago on May 20, 2003, 12:48 AM
You really should just use size_t's for size variables, but it doesn't really matter.
Title: Re:Starting my journey through the lands of C++!
Post by: Grok on May 20, 2003, 06:02 AM
Quote from: iago on May 20, 2003, 12:48 AM
You really should just use size_t's for size variables, but it doesn't really matter.

ASSERT( size_t counts );
Title: Re:Starting my journey through the lands of C++!
Post by: EvilCheese on May 20, 2003, 06:03 AM
Also, you'll come to realise that "60 errors" doesnt necessarily mean "60 things wrong with your code".

In some situations you can fix 30 errors just by adding/modifying one line, or repositioning a single semicolon... though that's usually when your errors are caused by an oversight rather than a basic flaw in logic.

If you throw away a whole project just cuz of a missing #include line in a class declaration header, you'll kick yourself later :P
Title: Re:Starting my journey through the lands of C++!
Post by: EvilCheese on May 20, 2003, 06:06 AM
Quote from: Grok on May 20, 2003, 06:02 AM
Quote from: iago on May 20, 2003, 12:48 AM
You really should just use size_t's for size variables, but it doesn't really matter.

ASSERT( size_t counts );

Grok, that was painful :P

I'm embarrased to admit that I actually laughed out loud ;)
Title: Re:Starting my journey through the lands of C++!
Post by: Zakath on May 20, 2003, 09:29 AM
Quote from: iago on May 20, 2003, 12:48 AM
You really should just use size_t's for size variables, but it doesn't really matter.

Note that they said "argument." The conversion was taking place where variables of type size_t were being passed into functions in place of DWORDs. Had nothing to do with any variables I may or may not have declared as size_t.