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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:03:17+00:00 2026-06-13T09:03:17+00:00

I have following c code: #define ASSERT_ACTIVE(active) do { if (!active) return errno =

  • 0

I have following c code:

#define ASSERT_ACTIVE(active) do { if (!active) return errno = 6, -1; } while (0);
#define errno (*_errno())

int someCrazyFunc (bool active) {
    ASSERT_INACTIVE (active);
    ...
}

As far as I know a #define will simply place replacement text in place of the specified identifier.

I like to know:

  • What does return errno = 6, -1; means? is that returns two values in one return statement?
  • What is the meaning of replacement code (*_errno()) = 6
  • 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-13T09:03:18+00:00Added an answer on June 13, 2026 at 9:03 am

    There isn’t a second value – a return statement returns exactly one value. In the statement:

    return errno = 6, -1;
    

    The return value is the result of the expression errno = 6, -1. This is an expression using the comma operator – it is parsed as (errno = 6), -1, which evaluates to -1 and assigns 6 to errno as a side-effect. So this means that it’s equivalent to the two statements:

    errno = 6;
    return -1;
    

    Assuming that _errno() is a function returning a pointer – for example it has a return type of int * – then the expression (*_errno()) = 6 assigns the value 6 to the object pointed to by the return value of the function. It would be equivalent to code similar to:

    int *p = _errno();
    *p = 6;
    

    errno is often defined like this in order to give each thread in a multi-threaded implementation its own errno. The function _errno() in this case would return a pointer to the current thread’s errno variable.

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

Sidebar

Related Questions

I have the following code: #include <stdlib.h> #include <stdio.h> #define SIZE 100 int* arr;
I have the following code #define PROC_ADD void main(void) { while(1) { #ifdef PROC_ADD
I have the following code: #define INPUT_FILE -i int main(int argc, char* argv[]) {
I have the following code snippet: #ifdef DO_LOG #define log(p) record(p) #else #define log(p)
I have the following code: #include <iostream> #define BOOST_TEST_MODULE my test #include <boost/test/unit_test.hpp> BOOST_AUTO_TEST_CASE(
I have the following code: #include <stdio.h> #include <pthread.h> #define THREAD_CNT 10 #define ITER
I have the following code: #include <stdlib.h> #include <stdio.h> #include <pthread.h> #define NUM_THREADS 100
i have the following piece of code in php: define('QUERY', $some_query_string); if(empty(QUERY) || mb_strlen(QUERY)
I have the following code: private void SetControlNumbers() { string controlString = ; int
I have the following code : #define ANG_TO_RAD(angle) ( angle/180*M_PI) CGFloat degree = x;

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.