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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:54:49+00:00 2026-06-14T17:54:49+00:00

The following testcode creates a server- and a clientsocket. Then client sends a message

  • 0

The following testcode creates a server- and a clientsocket. Then client sends a message to server and server replies. Thats all. But I can’t compile. All ASSERT_EQ in the threadfunctions raise the error "error: void value not ignored as it ought to be". I have no clue what this should tell me. What is the problem in here? Type is irrelevant as ASSERT_EQ(1, 1); raises the errors too.

EDIT Found this in FAQ from google:

Q:My compiler complains “void value not ignored as it ought to be.” What does this mean?

A: You’re probably using an ASSERT_XY() in a function that doesn’t return void. ASSERT_XY() can only be used in void functions.

How shall I understand this?

void * serverfunc(void * ptr);  
void * clientfunc(void * ptr);    

TEST(netTest, insert)
{
  pthread_t mThreadID1, mThreadID2;
  ::pthread_create(&mThreadID1, nullptr, serverfunc, nullptr);
  ::sleep(1);
  ::pthread_create(&mThreadID1, nullptr, clientfunc, nullptr);
  ::pthread_join(mThreadID1, nullptr);
  ::pthread_join(mThreadID2, nullptr);        
}

void * serverfunc(void * ptr)
{
  net::ServerSocket serv(IPV4, TCP, 55555,5);
  net::ServerSocket * conn = serv.accept();
  net::Message msg;

  conn->recvmsg(&msg);

  ASSERT_EQ(msg.size(),5);
  ASSERT_EQ(msg[0],1);
  ASSERT_EQ(msg[1],2);
  ASSERT_EQ(msg[2],3);
  ASSERT_EQ(msg[3],4);
  ASSERT_EQ(msg[4],5);

  msg = {9,8,6};
  ASSERT_EQ(msg.size(),3);
  ASSERT_EQ(msg[0],9);
  ASSERT_EQ(msg[1],8);
  ASSERT_EQ(msg[2],6);

  conn->sendmsg(msg);

  ::sleep(1);

  delete conn;
  return 0;
}

void * clientfunc(void * ptr)
{
  net::ClientSocket clie(IPV4, TCP, "localhost",55555);
  net::Message msg;

  msg = {1,2,3,4,5};
  ASSERT_EQ(msg.size(),5);
  ASSERT_EQ(msg[0],1);
  ASSERT_EQ(msg[1],2);
  ASSERT_EQ(msg[2],3);
  ASSERT_EQ(msg[3],4);
  ASSERT_EQ(msg[4],5);

  clie.sendmsg(msg);

  clie.recvmsg(&msg);

  ASSERT_EQ(msg.size(),3);
  ASSERT_EQ(msg[0],9);
  ASSERT_EQ(msg[1],8);
  ASSERT_EQ(msg[2],6);

  return 0;
}
  • 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-14T17:54:50+00:00Added an answer on June 14, 2026 at 5:54 pm

    Q:My compiler complains “void value not ignored as it ought to be.”
    What does this mean?

    A: You’re probably using an ASSERT_XY() in a function that doesn’t
    return void. ASSERT_XY() can only be used in void functions.

    How shall I understand this?

    Your functions don’t return void, they return void* – i.e. they return something (void* is a pointer-to-anything) while they should return nothing. The FAQ says it is required for the functions which use ASSERT_EQ() to have the void return type.

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

Sidebar

Related Questions

Following chunk html code works as expected: <iframe src=http://www.amazon.com/></iframe> But when trying embed inner
I'm attempting to translate the following C# code into IronPython but I don't know
In the following code I parse following web service, but when I parse comments
This has probably been asked a thousand times... But i'm sure i have all
{Following is the vb.net code for IPN listener: If Me.TestMode = True Then Me.RequestUrl
I have the following test-code: CREATE TABLE #Foo (Foo int) INSERT INTO #Foo SELECT
I have the following test code use Data::Dumper; my $hash = { foo =>
following situation: <body> <div style=position:fixed; width:100%>[place holder for header]</div> <div style=position:relative;width:100%;margin-top:100px>[content]</div> </body> I need
Following code produces a nested array as a result for keys containing three items:
Following code takes like 2500 milliseconds on an i7-*3.4 GHz windows-7 64-bit computer to

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.