Thread: Is this valid?

  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    6

    Is this valid?

    Hi,
    Is this puts statement valid? ..Ive come across something alike in vlc source code ..
    insert
    Code:
    #define VERSION abc
    
    static void version (void)
    {
        puts ("LibVLC plugins cache generation version " VERSION);
      }

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    No. Why would you even use it?
    This is C code, not C++.
    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.

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    If the first line was changed to:
    Code:
    #define VERSION "abc"
    then it would be valid.
    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

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by laserlight View Post
    If the first line was changed to:
    Code:
    #define VERSION "abc"
    then it would be valid.
    Just to clarify on that, a part of the language is that two adjacent string literals are concatenated.

    Code:
    char x [] = "Hello "     "world";
    is equivalent to
    Code:
    char x [] = "Hello world";
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  5. #5
    Registered User
    Join Date
    Jun 2008
    Posts
    62
    Quote Originally Posted by Elysia View Post
    No. Why would you even use it?
    This is C code, not C++.
    Does the language standard support its use? Then it is valid. You can use a large portion of C code in the C++ language, it is still valid. It might be considered inelegant, but not invalid.

    other then that, what laserlight said.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Socket file descriptor valid and then not valid
    By Florian in forum C Programming
    Replies: 3
    Last Post: 05-22-2010, 08:23 AM
  2. Minimum valid address value
    By BMintern in forum C Programming
    Replies: 6
    Last Post: 04-12-2008, 08:21 AM
  3. recursion error
    By cchallenged in forum C Programming
    Replies: 2
    Last Post: 12-18-2006, 09:15 AM
  4. Are these valid operators
    By Morgan in forum C Programming
    Replies: 3
    Last Post: 08-12-2003, 11:56 AM
  5. Azbia - a simple RPG game code
    By Unregistered in forum Game Programming
    Replies: 11
    Last Post: 05-03-2002, 06:59 PM