prototyping a class

This is a discussion on prototyping a class within the C++ Programming forums, part of the General Programming Boards category; That's very context specific, how to handle the arguments, is it not?...

  1. #16
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,420
    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 11:24 AM. Reason: Fixed a small error.

  3. #18
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,420
    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,893
    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

Page 2 of 2 FirstFirst 12
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
  5. Abstract class problem
    By VanJay011379 in forum C++ Programming
    Replies: 9
    Last Post: 07-31-2002, 01:30 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21