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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:33:02+00:00 2026-05-12T05:33:02+00:00

Can this ever happen ? 3 asserts, where one should activate. int nr =

  • 0

Can this ever happen ?
3 asserts, where one should activate.

int nr = perform_calc();
assert( nr == 0);
assert( nr > 0);
assert( nr < 0);

Can there be a case when the program doesn’t activate the asserts on g++ 3.4.4.

And no I don’t have the possibility to change the code in order to print the number out in case the asserts don’t activate.

Any ideas?

Edit: After reading several comments I was forced to edit. Show the code? why are you doing this stupid thing ? I don’t believe it ! Where is it used ?
From my question it should have been obvious that I will not post/change the code because of several possible reasons:

  • I’m a total beginner and is ashamed of the code (no crime there, sure it makes answering to the question much easier if I did post it)
  • I was asked to help out a friend with only little information (and no I did not ask him why can’t you check the number returned, or why can’t he just add a breakpoint).
  • I am writing my code in emacs without any compiler and is sending it to a remote server that compiles it, runs it and only can return failed asserts if something goes wrong.

If you believed that I was making a prank or a hoax you should have voted for a closure of the thread instead. I would have been perfectly fine with that. But adding unnecessary comments like this only made me want an “attitude” flag to be implemented.

I want to thank others for their comments and answers that actually tried to explain and answered my question.

  • 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-12T05:33:03+00:00Added an answer on May 12, 2026 at 5:33 am

    As I’ve seen so ugly things in my life, it could be explained if perform_calc() has a buffer overrun that overwrites the return address in the stack. When the function ends, the overwritten address is recovered from the stack and set to the current PC, leading to a jump maybe in another area of the program, apparently past the assertion calls.

    Although this is a very remote possibility, so it’s what you are showing.

    Another possibility is that someone did an ugly macro trick. check if you have things like

    #define assert 
    

    or some colleague put something like this in a header while you were at the restroom

    #define < ==
    #define > ==
    

    As suggested in another answer, check with gcc -E to see what code is actually compiled.

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

Sidebar

Ask A Question

Stats

  • Questions 145k
  • Answers 145k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I can't stress how very, very, very bad this is.… May 12, 2026 at 8:49 am
  • Editorial Team
    Editorial Team added an answer You can always use plain C stuff in Objective-C (I… May 12, 2026 at 8:49 am
  • Editorial Team
    Editorial Team added an answer Once again, spring has thought of this use case and… May 12, 2026 at 8:49 am

Related Questions

I'm playing with LINQ-To-SQL in .NET 3.5 and have built some classes based on
I've actually solved this, but I'm posting it for posterity. I ran into a
this may come as pretty odd but I'm now working on a membership based
DO NOT DO THIS. This question is still getting upvotes, so I wanted to
Consider this scenario. I have an object, lets call it.... Foo. Foo raises a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.