Thread: pass two string in this program...

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by king_zart View Post
    is there any way to use intializer list without {}?
    for example use this
    Code:
     foo(1, 2, 3, 4, 5, 6, 7, 8, 9 );

    instead of
    Code:
     foo({1, 2, 3, 4, 5, 6, 7, 8, 9 });
    You can do it using variadic templates as shown by Elkvis. But why do you reject the bracer syntax so much?
    Last edited by Elysia; 12-11-2012 at 03:11 PM.
    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. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by Elysia View Post
    But who do you reject the bracer syntax so much?
    I'm guessing you meant "why."

    I don't reject it. I just don't think it's the right tool for the job in a sprintf() function, particularly when the OP clearly shows it being used for string and numeric types.

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Elkvis View Post
    I'm guessing you meant "why."

    I don't reject it. I just don't think it's the right tool for the job in a sprintf() function, particularly when the OP clearly shows it being used for string and numeric types.
    I mean why
    Also, I was aiming for the OP, not you. You clearly know when initializer list is good for the job, and when it isn't. But the OP seem to just reject it purely out of a syntactical view.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pass string array from C++ to C#
    By mosu' in forum C++ Programming
    Replies: 1
    Last Post: 08-06-2007, 06:31 AM
  2. pass string into main
    By chico1st in forum C++ Programming
    Replies: 7
    Last Post: 07-21-2007, 11:06 PM
  3. Using MC++ How do you pass a String between forms?
    By Dream Theater in forum Windows Programming
    Replies: 1
    Last Post: 04-30-2005, 06:23 AM
  4. how to pass a string as an argument?
    By waxydock in forum C++ Programming
    Replies: 3
    Last Post: 03-26-2005, 05:40 PM
  5. can c let me pass string references??
    By adaly in forum C Programming
    Replies: 9
    Last Post: 01-09-2002, 04:17 PM