Thread: Is this C++?

  1. #1
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    segmentation fault

    Is this C++?


    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:
    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
    Farncombe, Surrey, England
    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.

    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
    > 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