hi all,
while I read the code from linux sources.
I read the statement
static const struct iw_ioctl_descri ption standard_ioctl[] = {
[SIOCSIWCOMMIT - SIOCIWFIRST] = {
.header_type = IW_HEADER_TYPE_ NULL,
},
...
};
I have never read such code. normaly, I will write the code as :
static const struct iw_ioctl_descri ption standard_ioctl[] = {
{
.header_type = IW_HEADER_TYPE_ NULL,
},
...
};
anyone would help me? thanks 4 1966
"Anonymousgoogl edeja" <as*******@hotm ail.com> writes: while I read the code from linux sources.
I read the statement
static const struct iw_ioctl_descri ption standard_ioctl[] = { [SIOCSIWCOMMIT - SIOCIWFIRST] = { .header_type = IW_HEADER_TYPE_ NULL, }, ... };
I have never read such code. normaly, I will write the code as :
static const struct iw_ioctl_descri ption standard_ioctl[] = { { .header_type = IW_HEADER_TYPE_ NULL, }, ... };
The [SIOCSIWCOMMIT - SIOCIWFIRST] specifies an array index.
Presumably SIOCSIWCOMMIT-SIOCIWFIRST is an integer constant
expression.
By specifying the index values, you don't necessarily have to give the
array elements in order.
--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
I wonder whether it's gcc specific or ANSI std specific?
Keith Thompson wrote: "Anonymousgoogl edeja" <as*******@hotm ail.com> writes: while I read the code from linux sources.
I read the statement
static const struct iw_ioctl_descri ption standard_ioctl[] = { [SIOCSIWCOMMIT - SIOCIWFIRST] = { .header_type = IW_HEADER_TYPE_ NULL, }, ... };
I have never read such code. normaly, I will write the code as :
static const struct iw_ioctl_descri ption standard_ioctl[] = { { .header_type = IW_HEADER_TYPE_ NULL, }, ... };
The [SIOCSIWCOMMIT - SIOCIWFIRST] specifies an array index. Presumably SIOCSIWCOMMIT-SIOCIWFIRST is an integer constant expression.
By specifying the index values, you don't necessarily have to give the array elements in order.
-- Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst> We must do something. This is something. Therefore, we must do this.
"Anonymousgoogl edeja" <as*******@hotm ail.com> writes: Keith Thompson wrote: "Anonymousgoogl edeja" <as*******@hotm ail.com> writes: > while I read the code from linux sources. > > I read the statement > > static const struct iw_ioctl_descri ption standard_ioctl[] = { > [SIOCSIWCOMMIT - SIOCIWFIRST] = { > .header_type = IW_HEADER_TYPE_ NULL, > }, > ... > }; > > I have never read such code. normaly, I will write the code as : > > static const struct iw_ioctl_descri ption standard_ioctl[] = { > { > .header_type = IW_HEADER_TYPE_ NULL, > }, > ... > };
The [SIOCSIWCOMMIT - SIOCIWFIRST] specifies an array index. Presumably SIOCSIWCOMMIT-SIOCIWFIRST is an integer constant expression.
By specifying the index values, you don't necessarily have to give the array elements in order.
I wonder whether it's gcc specific or ANSI std specific?
Please don't top-post. Your reply goes below the quoted text, so the
entire article can be read from top to bottom.
Designators in initializers (including both the ".member=va lue" and
"[index]=value" forms) are a new feature in C99. (The term "ANSI" is
ambiguous; strictly speaking the current 1999 ISO standard is the ANSI
standard, but the term "ANSI" is commonly used to refer to the
1989/1990 ANSI/ISO standard.)
--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Anonymousgoogle deja a écrit : while I read the code from linux sources.
I read the statement
static const struct iw_ioctl_descri ption standard_ioctl[] = { [SIOCSIWCOMMIT - SIOCIWFIRST] = { .header_type = IW_HEADER_TYPE_ NULL, }, ... };
I have never read such code. normaly, I will write the code as :
static const struct iw_ioctl_descri ption standard_ioctl[] = { { .header_type = IW_HEADER_TYPE_ NULL, }, ... };
anyone would help me? thanks
Read again. 'iw_ioctl_descr iption standard_ioctl' is an *array* of
structure... For an 'absolute' initializing (C99), you also need the index.
--
C is a sharp tool This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jason |
last post by:
Hi,
I need a way to use random numbers in c++. In my c++ project, when using
the mingw compiler I used a mersenne twister that is publicly available and
this did its job well. Now I have shelled out on VC++ 6.0 compiling that
same code is proving difficult. I am not too worried how I generate random
numbers in c++, as long as it is sufficiently random.
Can anybody help me out in getting what I want from VC++?
|
by: Fred Zwarts |
last post by:
If I am right, members of a class that are const and not static
must be initialized in the initialization part of a constructor.
E.g.
class C {
private:
const int I;
public:
C();
};
|
by: Henry |
last post by:
I finally thought I had an understanding of multi dimensional arrays in C
when I get this:
#include <stdio.h>
#define max_x 3
#define max_y 5
int array;
|
by: djinni |
last post by:
It's been a while since I've written anything in C, and
I was hoping to get some feedback on the following code.
As far as I can tell, the program works fine, but I'm not
sure I'm cleaning all the memory up properly, and I think
the "tokenize_my_string" function can probably be made better.
This program prompts the user for a text sentence,
then re-orders the words in a random fashion...
...
|
by: B. Wood |
last post by:
I have a small program (see below) that demonstrates an error I am
getting when I build the program on a linux platform.
I first initialize an unsigned char array (lines 16).
I then initialize my array of my typedeffed structure (dataStruct)
(lines 18-24). I use my initialized unsigned character array to
initialize the unsigned character pointer member of the structure
(line 21).
| |
by: Stephen Mayes |
last post by:
I have initialized an array like this.
const char matrix =
{
{0, 1, 2, 3},
{0, 1, 2},
{0, 1}
};
gcc, (with no options set,) errors unless I specify
|
by: kk_oop |
last post by:
Hi. I recently wrote a simple little template that defines an array
that checks attempts to use out of bounds indexes. The only problem is
that it does provide the use array style value initialization when the
type is instantiated. Any suggestions for a mod that would allow array
initialization syntax?
***********Here's the type:
#ifndef CHECKED_ARRAY_
#define CHECKED_ARRAY_
|
by: toton |
last post by:
Hi,
I can initialize an array of class with a specific class as,
class Test{
public:
Test(int){}
};
Test x = {Test(3),Test(6)}; using array initialization list. (Note
Test do NOT have a default ctor).
Is it possible to do so in the class parameter initialization using
specific ctor?
|
by: jamx |
last post by:
How can you initialize an array, in the initialization list of a
constructor ??
SomeClass
{
public:
SomeClass() : *init here* { }
private:
int some_array;
};
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |