Is this valid?

This is a discussion on Is this valid? within the C++ Programming forums, part of the General Programming Boards category; Hi, Is this puts statement valid? ..Ive come across something alike in vlc source code .. insert Code: #define VERSION ...

  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をこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,169
    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.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,968
    If the first line was changed to:
    Code:
    #define VERSION "abc"
    then it would be valid.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    5,843
    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%.

  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, 08: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

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