Selfmade simple config parser

Started by
11 comments, last by Zakwayda 16 years, 2 months ago
Quote:Original post by ChJees
New code and i learnt how to use pointers in the process... (I am starting to like pointers :3.)

Still a lot of optimising to do though.

*** Source Snippet Removed ***
There were a number of suggestions made earlier that you haven't yet incorporated into your code. I'd recommend going back and taking another look at those.

Also:

1. Declare variables near first use, not at the top of the function.
2. Declare and initialize variables in the same statement rather than in different statements.
3. In the following code excerpt:
//New codestring *TempVar;TempVar = &Variables[prefix];*TempVar = suffix;              //Variables[prefix] = suffix; <- Obsolete
You actually had it right the first time (the use of pointers gains you nothing here).
Advertisement
Quote:Original post by jykYou actually had it right the first time (the use of pointers gains you nothing here).

Wrong, this lets me use any Map i want. Not just the predefined one i used before this Pointer solution.

Give me some time to implement and optimise all the suggestions. I do not code all day long you know :P.

I try to do as much as i can myself so i actually learn something when coding. Later when i start making real games so am i going to consider allready developed libraries and snippets.

Give a learning newb a break. (Yes, i consider myself a newbie STILL.)
Quote:Original post by ChJees
Quote:Original post by jyk
You actually had it right the first time (the use of pointers gains you nothing here).

Wrong, this lets me use any Map i want. Not just the predefined one i used before this Pointer solution.
Hm, are you sure about that? Unless I'm missing something really obvious, your pointer-based code does the exact same thing that the commented-out line does, only in a more roundabout way.

This topic is closed to new replies.

Advertisement