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 5970557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:23:33+00:00 2026-05-22T20:23:33+00:00

I’m reading source code of nginx and find it’s not initializing many of the

  • 0

I’m reading source code of nginx and find it’s not initializing many of the numerical variables, including ngx_int_t ngx_last_process;,here ngx_int_t defined as long int

#if 0
    ngx_last_process = 0;
#endif

So here @Igor Sysoev think it unnecessary to do the initialization?

But in the programe it’s assuming the default value is 0:

    for (s = 0; s < ngx_last_process; s++) {
        if (ngx_processes[s].pid == -1) {
            break;
        }
    }

Is it guranteed that un-initialized variable will have 0 value in c at all?

  • 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-05-22T20:23:34+00:00Added an answer on May 22, 2026 at 8:23 pm

    External and static variables are initialized to zero by default, this is guaranteed. Automatic and register variables that do not have en explicit initializer will have an indeterminate value (either an unspecified value or a trap representation).

    From The Standard:

    C89

    6.5.7:

    If an object that has static storage duration is not initialized
    explicitly, it is initialized implicitly as if every member that has
    arithmetic type were assigned 0 and every member that has pointer type
    were assigned a null pointer constant. If an object that has
    automatic storage duration is not initialized explicitly, its value is
    indeterminate.

    C99

    6.2.4, §5:

    For such an object that does not have a variable length array type, its lifetime extends
    from entry into the block with which it is associated until execution of that block ends in
    anyway.(Entering an enclosed block or calling a function suspends, but does not end,
    execution of the current block.) If the block is entered recursively,anew instance of the
    object is created each time. The initial value of the object is indeterminate. If an
    initialization is specified for the object, it is performed each time the declaration is
    reached in the execution of the block; otherwise, the value becomes indeterminate each
    time the declaration is reached.

    6.7.8, §10:

    If an object that has automatic storage duration is not initialized explicitly,its value is indeterminate. If an object that has static storage duration is not initialized explicitly, then:

    — if it has pointer type, it is initialized to a null pointer;

    — if it has arithmetic type, it is initialized to (positive orunsigned) zero;

    — if it is an aggregate, every member is initialized (recursively) according to these rules;

    — if it is a union, the first named member is initialized (recursively) according to these rules.

    3.17.2, §1:

    indeterminate value: either an unspecified value or a trap representation

    3.17.3, §1:

    unspecified value: valid value of the relevant type where this International Standard imposes no requirements on which value is chosen in any instance. NOTE An unspecified value cannot be a trap representation.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I need to clean up various Word 'smart' characters in user input, including but
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I need a function that will clean a strings' special characters. I do NOT
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.