Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

low_rider_bunny

How do you read other peoples code

This topic is 5151 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am super new to Code and stuff, And have spent time reading C books and want to jump into a project of www.blender3d.org But when ever I go to try and do anything the source code over welms me and I getlost to quickly, not one of my C books covers this subject at all, they just tell you haw to make new stuff, but no way to read someon elses code. Also is there any Graphical or visual tool for C to kinda help out with how on eaarth this stuff relates with its self ? I am not from the Code world, just happy visual flippy fun stuff and colors ! ^v^

Share this post


Link to post
Share on other sites
Advertisement
as you learn more of the language other people's code will make more sense. it's always a bit of a task figuring out how someone's code works, but worry about writing your own code first. it's not helpful looking at other people's code before you know the basics of the language. you'll just confuse yourself and slow down your learning curve.

-me

[edited by - Palidine on June 8, 2004 8:41:29 PM]

Share this post


Link to post
Share on other sites
Thay might be using a graphics api such as directx and that will make it harder for you to read it. Or they could be using c++ and not c.

I read other peoples code all the time I find it a good way to learn something you cant find in a tutorial.

Share this post


Link to post
Share on other sites
This is the kind of things you just need to practice with. If you''re having trouble reading others'' code, try getting some more advanced books first. Also, it help if you don''t look at an entire project all at once.

It can take alot of time to ease into someone else''s code. Take little pieces at a time, look at the docs if there are any. Take it slow.

Share this post


Link to post
Share on other sites
also, if you are "super new to Code and stuff" starting with a blender project is probably reaching to high. i would reccommend not just reading through the books, but also actually writing/compiling/running some of the book''s assignments or test problems. after you work your way to the end of the book, you should pick a simple project to start with, like a text based game. after that eveyone''s favorite progression is pong -> tetris -> whatever you like.

be aware that in order to work on a 3D project you will also need to know at least some basic linear algebra (understand vectors & matrices at the very least). without that, some one else''s code will never make sense because a decent part of their code will be implementations of those mathematics.

-me

Share this post


Link to post
Share on other sites
ctags is an awesome tool for navigating code. You can find info on the website, but basically, once you have ctags set up, you can move the cursor over a function call, press control-], and then BAM, the definition of that function pops up. Or you can move the cursor over a variable, press control-], and BAM, you go straight to the declaration. Or instead of control-], you can press control-}, and the definition will pop up in a tiny little preview window (so that it doesn't take you away from the file you're working on.)

Note that all of those key shortcuts are actually from Vi. Ctags doesn't really work on its own- you need a cool text editor like Vi or Emacs that can understand the 'tags' file that Ctags generates. If you want Vi, get gVim, and if you want Emacs, get Xemacs.

There's another tool, cscope, which I haven't used yet, but seems to provide even more features than ctags. Both emacs and vi also have built-in support for cscope.

And yeah- my implied suggestion is to get an awesome text editor. Both Vi and Emacs are awesome. Both will take a little time to get used to (Vi actually takes a LOT of time to get used to), but it will pay off in the long run.

[edited by - pinacolada on June 8, 2004 9:39:39 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by pinacolada
ctags is an awesome tool for navigating code. You can find info on the website, but basically, once you have ctags set up, you can move the cursor over a function call, press control-], and then BAM, the definition of that function pops up. Or you can move the cursor over a variable, press control-], and BAM, you go straight to the declaration. Or instead of control-], you can press control-}, and the definition will pop up in a tiny little preview window (so that it doesn''t take you away from the file you''re working on.)

Note that all of those key shortcuts are actually from Vi. Ctags doesn''t really work on its own- you need a cool text editor like Vi or Emacs that can understand the ''tags'' file that Ctags generates. If you want Vi, get gVim, and if you want Emacs, get Xemacs.

There''s another tool, cscope, which I haven''t used yet, but seems to provide even more features than ctags. Both emacs and vi also have built-in support for cscope.

And yeah- my implied suggestion is to get an awesome text editor. Both Vi and Emacs are awesome. Both will take a little time to get used to (Vi actually takes a LOT of time to get used to), but it will pay off in the long run.

[edited by - pinacolada on June 8, 2004 9:39:39 PM]



Oooo Those are sweet I never knew I had those tools on my command line :D It will help with definitions.

Share this post


Link to post
Share on other sites
quote:
Original post by nonnus29
Goto a site such as allegro.cc; there are tons of games on the depot with source code.


Sweet! I will stare at those but it still suffers from the , reading someone elses code syndrome

Share this post


Link to post
Share on other sites
quote:
Original post by pinacolada
ctags is an awesome tool for navigating code. You can find info on the website, but basically, once you have ctags set up, you can move the cursor over a function call, press control-], and then BAM, the definition of that function pops up. Or you can move the cursor over a variable, press control-], and BAM, you go straight to the declaration. Or instead of control-], you can press control-}, and the definition will pop up in a tiny little preview window (so that it doesn''t take you away from the file you''re working on.)

Note that all of those key shortcuts are actually from Vi. Ctags doesn''t really work on its own- you need a cool text editor like Vi or Emacs that can understand the ''tags'' file that Ctags generates. If you want Vi, get gVim, and if you want Emacs, get Xemacs.

There''s another tool, cscope, which I haven''t used yet, but seems to provide even more features than ctags. Both emacs and vi also have built-in support for cscope.

And yeah- my implied suggestion is to get an awesome text editor. Both Vi and Emacs are awesome. Both will take a little time to get used to (Vi actually takes a LOT of time to get used to), but it will pay off in the long run.

[edited by - pinacolada on June 8, 2004 9:39:39 PM]


DO they have anything like for the VS 6.0 text editor?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!