Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Trying to learn to code better

 
Post new topic   Reply to topic Printable version
 View previous topic  Internet Connection Post :: Post Paintball zone, almost operational.  View next topic  
Author Message
Pests
Novice


Joined: Feb 24 2003
Posts: 84
Offline

PostPosted: Sun Jun 20, 2004 11:50 pm   Post maybe stupid    Post subject: Trying to learn to code better Reply to topic Reply with quote

Hi, I've really been trying to code better recently, but I feel I'm not useing MSVC6 correctly or to its fullest potential. Could someone direct me where I could learn more about it or someone teach me? For example, the only things I really ever do is run the program, and fix any bugs that come up. I'm sure theres better ways out there then to guess and check whats wrong and how to fix, ect. Like, I hear talk of break points and all the good things, but I don't know how to use them.
Back to top
View users profile Send private message Add User to Ignore List
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Mon Jun 21, 2004 12:27 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

Not really, other than learn the language well; then while learning hopefully you'll learn how to debug well. icon_smile.gif

www.cplusplus.com
_________________
Performance is often the art of cheating carefully. - James Gosling
Back to top
View users profile Send private message Add User to Ignore List
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Mon Jun 21, 2004 12:36 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

Write a simple Win32 console app, and put in a bug on purpose. Then start playing with the debugger to see how easy it is to see what's going on knowing where the bug is. Here's a small app with 2 bugs. I'll let you figure out what they are.

Code: Show/Hide
#include "stdio.h"

void main ()
{
char *p = "this is a string";
char *q;
char  buf[64];

q = buf;

while (p)
   *q++ = *p++;

printf("The buffer = %s\n", buf);
}


Play around with the debug stuff after this crashes. If you need more direction, reply here where you are and I'll help some more.
_________________
4,691 irradiated haggis!
Back to top
View users profile Send private message Add User to Ignore List
50% Packetloss
Server Help Squatter


Age:40
Gender:Gender:Male
Joined: Sep 09 2003
Posts: 561
Location: Santa Clarita, California
Offline

PostPosted: Mon Jun 21, 2004 4:05 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

Pick up a book, browse through the stuff that you think you know and check out anything that looks new. Maybe sign up for a class to teach you a lower level language.

I believe i got the answer, translated it into hex so i didnt spoil it for anyone else
23696E636C756465203C737464696F2E683ED0A0696E74206D61696E2829D0A07768696C6520282A702920D0A072657475726E20303B00
http://nickciske.com/tools/hex.php
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Mon Jun 21, 2004 4:07 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

Good idea icon_smile.gif
Back to top
View users profile Send private message Add User to Ignore List
Dustpuppy
Server Help Squatter


Age:40
Gender:Gender:Male
Joined: Jan 23 2003
Posts: 215
Location: England
Offline

PostPosted: Mon Jun 21, 2004 6:10 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

I'd say one of your bugs is correct but the others are pretty irrelevant. Besides Ekted said there were 2 bugs and you gave 3 tongue.gif
I think the remaining bug will be fairly obvious if you run it after finding the first one.
_________________
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:42
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3615
Location: Las Vegas
Offline

PostPosted: Mon Jun 21, 2004 11:18 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

Main does not need to be an int. And if it does, you are not required to have a return 0 at the end, as it is implied. These are somewhat recent changes, but I read about them somewhere when someone whined that GCC no longer prints warnings or errors or something whenever they don't have the return 0 statement.

I would google more for answers, but the main function is special, and having it be void, or int without a return statement, is perfectly legitimate.

EDIT: Bah, I'm not one to go without googling for answers. Here, read this.
Back to top
View users profile Send private message Add User to Ignore List Send email
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Mon Jun 21, 2004 3:01 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

50% you missed one of the real bugs... icon_smile.gif
Back to top
View users profile Send private message Add User to Ignore List
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Mon Jun 21, 2004 3:05 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

23696E636C7564652022737464696F2E6822D0A0D0A0766F6964206D6169
6E20282920D0A07B20D0A09063686172202A70203D20227468697320697
3206120737472696E67223B20D0A09063686172202A713B20D0A09063686
17220206275665B36345D3B20D0A0D0A09071203D206275663B20D0A0D
0A0907768696C6520282A7029D0A0907BD0A090902A712B2B203D202A7
02B2B3B20D0A0907DD0A0902A71203D20303BD0A0D0A0907072696E746
6282254686520627566666572203D2025735C6E222C20627566293B20D0
A07D00

http://nickciske.com/tools/hex.php
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Mon Jun 21, 2004 4:42 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Good icon_smile.gif
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Tue Jun 22, 2004 1:27 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

OK, I got the "first" bug just by looking at it, but not the second. I seem to think for some reason that arrays are automatically zeroed?
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Tue Jun 22, 2004 3:12 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Nothing happens without code.

In VC debugger, all uninitialized stack space and allocated space are filled with specific bytes, so if you have a bug and notice this particular byte, it's a clue that something is uninitialized. Freed memory is filled with a different byte, so it's easier to tell when you are still referencing freed memory.
Back to top
View users profile Send private message Add User to Ignore List
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Trash Talk All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 30 page(s) served in previous 5 minutes.

phpBB Created this page in 0.959396 seconds : 35 queries executed (89.9%): GZIP compression disabled