Is this C++?

This is a discussion on Is this C++? within the C Programming forums, part of the General Programming Boards category; Sigh. I have a webcam that doesn't work under linux so I've decided to write a driver for it. I ...

  1. #1
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300

    Is this C++?

    Sigh.

    I have a webcam that doesn't work under linux so I've decided to write a driver for it. I started reading an article demoing the process and right away ran into this:
    Code:
    static struct usb_driver led_driver = {
    	.owner =	THIS_MODULE,
    	.name =		"usbled",
    	.probe =	led_probe,
    	.disconnect =	led_disconnect,
    	.id_table =	id_table,
    };
    which if this is C++ my project just became more difficult, because some form of this struct is necessary.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    It is a gcc extension to name the fields of a struct for the elements, rather than just putting the fields in the order they appear in the original struct.

    It should work just fine in C, as long as you are using gcc - which you probably will do in Linux.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    > It is a gcc extension to name the fields of a struct for the elements
    It's standard in C99.

    Not sure if the Microsoft compilers adopted it or not.

Popular pages Recent additions subscribe to a feed

Tags for this Thread


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