Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7724459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:41:39+00:00 2026-06-01T04:41:39+00:00

55 typedef struct pidmap { 56 atomic_t nr_free; 57 void *page; 58 } pidmap_t;

  • 0
55 typedef struct pidmap {
56         atomic_t nr_free;
57         void *page;
58 } pidmap_t;
59 
60 static pidmap_t pidmap_array[PIDMAP_ENTRIES] =
61          { [ 0 ... PIDMAP_ENTRIES-1 ] = { ATOMIC_INIT(BITS_PER_PAGE), NULL } };

The code snippet above shows the initialization of an array of a structs that I found in the Linux kernel source. I have never seen this form of initialization before and I couldn’t simulate the same thing on my own. What am I missing actually?

Source of the code

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T04:41:41+00:00Added an answer on June 1, 2026 at 4:41 am

    It is a GNU/GCC extension called Designated Initializers. You can find more information about it in the GCC documentation.

    To initialize a range of elements to the same value, write [first ... last] = value. This is a GNU extension

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

typedef struct _ut_slot { ucontext_t uc; .... }*ut_slot; static ut_slot* table; //array of the
Given the code below: typedef struct {int a;} test_t; arbitrary_t test_dosomething(test_t* test) { if
typedef struct Value{ int id; char type; char a; } Value; void fooV(Value v){
typedef struct dict_pair { void *key; void *value; struct dict_pair *head; struct dict_pair *tail;
typedef struct { nat id; char *data; } element_struct; typedef element_struct * element; void
typedef struct _protocol1 { int type; CGPoint pos; } Protocol1; -(void)sendData { NSError *error;
typedef struct vertex{ int num; struct vertex *next; } Vertex; Vertex *adj[1]; void buildList(){
I have this code typedef struct { const char* fooString; const bool fooBool; }fooStruct;
consider the fallowing code: typedef struct port * pport; struct port { int a;
typedef struct _DListNode { struct _DListNode* prev; struct _DListNode* next; void* data; }DListNode; in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.