Jump to content
  • Advertisement


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


review my crap code

This topic is 5801 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, im a newbie programmer, self taught and i would like some oppinions on my simple scripting language, and vm. i know that its messy, but do you think it is salvegable ? please review it and tell me what you guys think http://www.eminence.co.nz/libcl.zip thanx -silvermace [edit: st0pid me, forgot the link ] [edited by - silvermace on January 20, 2003 2:03:23 AM]

Share this post

Link to post
Share on other sites
There's too much of it, but I'll take a peek. Be prepared for lame comments that mostly concern about how the code looks

*takes the peek*

I don't know about the scripting language, the examples don't say much. So I'll comment the code in vm instead..

What's the use of CStack? std::stack is ok too. Your stack is defined in two places too. And the layout breaks if tab isn't set to 4 (now that's an important thing!). You have too little of documentation and comments (almost none). You should throw classes instead of string literals, so they can be caught and acted upon appropriately. Sometimes you have _ prefix for variable names, sometimes not.. I couldn't see any pattern, there was code like
string _Lbl = Lbl;
.. very confusing. Sometimes you use hungarian notation, sometimes not. Try to be more consistent. You should break the code into smaller functions, now I spotted some pretty huge ones that are hard to follow, even though they had parts that could've easily been broken in to several other functions

I don't know if this helps at all, but I don't have time for a closer look of what the code is actually supposed to be doing..

[edited by - civguy on January 20, 2003 7:17:33 PM]

Share this post

Link to post
Share on other sites
Not bad for a crap code. Most of the coding ''deficiency'' mentioned by civguy, so I need not repeat it.

Just want to know, whats the difference:
- _thisVariable
- _ThisVariable
- __thisVariable
- ThisVariable
- thisVariable
- m_thisVariable
- m_lpThisVariable
- this_variable
- This_variable
... etc... I can''t list all down

Prefix a ''p'' for pointers type, it''s more readable for me.

Try minimize the usage of #define. You got few number of #define that is unncessary. e.g. use inline function for your FORMAT macro.

Nice line spacing would be useful here.

Instead of pass by pointers, I''m more happy to see pass by reference... unless you need to check for nullness. Well, that''s just me.

Be very careful on function that returns pointer to a static variable.

*review #0.1*

p/s: just read your first few files (sort by name).

Share this post

Link to post
Share on other sites
well the varibale nameing is not all my fault, ok, fine .. busted, its becuase im a recent C convert and theres noone to slap my wrist

thanx for all the info, it will help my style ALOT and thanx
but could someone comment on the structure of my "compiler", is it good, is it worth continuing, or should i write one by the "book" -i do hav a copy of the "dragon book", will i stop using "quotes" lol :D?

anywayz, thanx so far :D

-danushka | sWitch

Share this post

Link to post
Share on other sites
you could keep bumping - or you could change the thread title to something more meaningful like ''my scripting lang compiler code review''. ''Review my code'' is an order, the infinitive, not particularly friendly.

Also give people an idea of what problems you feel there may be rather than expecting everyone to have a cold start with it.


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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!