Thread: prototyping a class

  1. #16
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    That's very context specific, how to handle the arguments, is it not?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  2. #17
    Registered User nempo's Avatar
    Join Date
    Aug 2007
    Posts
    39
    I thought I'd divide the arguments into key/value pairs, where the seperator is a '=', arguments without assigned values (ie. no '=') would become a key where the value is an empty string. Other then that the arguments would be seperated by whitespace.

    For example:

    Code:
    Argument     : (key, value)
    --------------------------------------------
    first=one    : ("first", "one")
    second = two : ("second", "two")
    -p           : ("-p", "")
    Last edited by nempo; 12-16-2007 at 12:24 PM. Reason: Fixed a small error.

  3. #18
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Ah, that makes sense. It's not that bad an idea, really.
    You could just make a utility function that parses arguments and returns a std::map, though.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #19
    Registered User nempo's Avatar
    Join Date
    Aug 2007
    Posts
    39
    Quote Originally Posted by Elysia View Post
    Ah, that makes sense. It's not that bad an idea, really.
    You could just make a utility function that parses arguments and returns a std::map, though.
    True, but this looks a bit more clean imo. :>.

    EDIT: my suggestion that is :>.

  5. #20
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Specializing class
    By Elysia in forum C++ Programming
    Replies: 6
    Last Post: 09-28-2008, 04:30 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Creating a database
    By Shamino in forum Game Programming
    Replies: 19
    Last Post: 06-10-2007, 01:09 PM
  4. Prototyping a class
    By Inquirer in forum Game Programming
    Replies: 8
    Last Post: 08-05-2002, 09:59 PM