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

  • SEARCH
  • Home
  • 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 6191101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:42:16+00:00 2026-05-24T02:42:16+00:00

I have spotted something in C header files what I can’t figure out what

  • 0

I have spotted something in C header files what I can’t figure out what is for. For example in file bits/socket.h there is an enumeration type enum __socket_type, but after every enumerator there is a define macro which defines the same. Example:

enum __socket_type
{
   SOCK_STREAM = 1,
   #define SOCK_STREAM SOCK_STREAM 
   ...
};

I have been unable to find out what this is for. Please enlighten me. I don’t even know how to form right question for querying google nor this site search box.

  • 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-24T02:42:17+00:00Added an answer on May 24, 2026 at 2:42 am

    A prepreprocessor macro will never expand recursively, so what such a #define does is leave the name in place whereever it is used. Such things are useful when you want to have a preprocessor feature test.

    #ifdef SOCK_STREAM
    ..
    #endif
    

    can be used to conditionally compile some code afterwards.

    Edit: So this combines the cleaner approach of enumerations (implicit values without collisions and scoping) with preprocessor tests.

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

Sidebar

Related Questions

I have spotted an example in book: iOS4 Programming Cookbook that I can't understand:
I have spotted something like this in code: void foo(IList<int>^ const & list )
I have just spotted that something is wrong with my django-admin.py command. I checked
Is there an Data Binding Parser/Generator of C header files (and/or Java jars) to
I have just spotted something that I am a little puzzled about, I wonder
I've spotted this question: Does Microsoft SkyDrive have an API? But not having an
In my past applications I have been #importing into my *.h files where needed.
I'm currently coding counter system and have spotted one problem with flash banners without
I'm currently working on subscription mail message and have spotted one moment. To make
I have spotted a method in some code that does the following : def

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.