Thread: How do I add a window to my program?

  1. #16
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Elkvis
    Obviously, it would be to add additional string-oriented functionality. Whitespace trimming, toupper, and tolower are just a few of the many things I'd like to have a string class do, without the aid of external functions.
    Not obvious though, since such additional functionality can often be added by extending the interface with non-member non-friend functions with no or negligible loss of efficiency. In fact, I recall that Sutter used std::basic_string as an example of a string class with too bloated a core interface such that it is monolithic.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #17
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by laserlight View Post
    Not obvious though, since such additional functionality can often be added by extending the interface with non-member non-friend functions with no or negligible loss of efficiency.
    My concern is less with efficiency, and more with productivity and convenience.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  3. #18
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    My concern is less with efficiency, and more with productivity and convenience.
    O_o

    Properly written non-member non-friend polymorphic interfaces increase productivity.

    Given that we have three string utilities--`ElkvisString', `laserlightString', and `PhantomString'--in the same application, for whatever reasons, we can create a `ToUpper' interface for each. Client code, thus the developer, doesn't need to remember to use `std::transform' with `laserlightString' or `ElkvisString::toupper' with `ElkvisString' or how to invoke locale specific `convertCase' with `PhantomString'; the developer can just use, creating if necessary, the same `ToUpper' interface.

    Not needing to know how to spell "convert all characters to upper case" or "trim leading whitespace" for a given string is a blessing.

    [Edit]
    ^_^

    The `PhantomString' is best string.
    [/Edit]

    [Edit]
    Elysia likes this.
    o_O

    You have come a long way...
    [/Edit]

    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  4. #19
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Elkvis
    My concern is less with efficiency, and more with productivity and convenience.
    I suggest reading:
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #20
    Registered User Alpo's Avatar
    Join Date
    Apr 2014
    Posts
    877
    Quote Originally Posted by phantomotap View Post

    [Edit]
    ^_^

    The `PhantomString' is best string.
    [/Edit]
    Code:
       myPhantomString.AppendFunnyFace( FF_RIGHT_WINK );
    Output: Greatest invention since sliced bread! ^.0

    WndProc = (2[b] || !(2[b])) ? SufferNobly : TakeArms;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. program to close its own window
    By wizard21212 in forum C Programming
    Replies: 5
    Last Post: 04-20-2011, 11:57 PM
  2. Window Program
    By illidari in forum C++ Programming
    Replies: 6
    Last Post: 03-11-2011, 04:48 PM
  3. Create a Program with no window
    By brconner in forum C++ Programming
    Replies: 8
    Last Post: 05-27-2007, 01:26 PM
  4. Simple window program
    By baniakjr in forum C++ Programming
    Replies: 5
    Last Post: 03-11-2006, 03:46 PM
  5. making a window program
    By DDX in forum C++ Programming
    Replies: 30
    Last Post: 03-21-2005, 04:12 PM