• Welcome to Valhalla Legends Archive.
 

Starting my journey through the lands of C++!

Started by Crypticflare, May 17, 2003, 07:25 AM

Previous topic - Next topic

Crypticflare

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!

drake

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.

Yoni

I doubt it'll run any faster if the compiler encounters 20 errors and 60 warnings.

iago

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..?
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


drake

I like my technique. I just say F it and stop working on it all together when I get too many errors.

Noodlez

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.

Zakath

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!).
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.


iago

You really should just use size_t's for size variables, but it doesn't really matter.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Grok

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 );

EvilCheese

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

EvilCheese

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 ;)

Zakath

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.
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.