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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:49:34+00:00 2026-06-08T04:49:34+00:00

We’ve all heard the warnings that if you invoke undefined behaviour in C or

  • 0

We’ve all heard the warnings that if you invoke undefined behaviour in C or C++, anything at all can happen.

Is this limited to any runtime behaviour at all, or does this also include any compile-time behaviour? In particular, is a compiler, upon encountering a construct that invokes undefined behaviour, allowed to reject the code (in the absence of other requirements in the standard to do so), or even to crash?

  • 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-08T04:49:36+00:00Added an answer on June 8, 2026 at 4:49 am

    "You’re all ignoring the actual definition and focusing on the note, The standard imposes no requirements." – @R.MartinhoFernandes

    The message above was written by the given user in Lounge<C++> and makes a very valid argument; the standard doesn’t impose any requirements when it comes to code that invokes undefined behavior.


    ! ! !

    undefined-behavior stretches even to the far corner of parsing the input data (ie. code) by the compiler, as verified with the below quotations from both the C++11 and C99 standards.

    To answer your question with one sentence;

    • undefined behavior is not limited to runtime execution, and it’s permissible to crash during compilation "in a documented manner characteristic of the environment" 1

    "in a documented manner characteristic of the environment" is a kind of odd statement, you could pretty much write a compiler documenting that it might crash upon any given code (that’s invalid) to grant it the possibility to crash whenever it wants to.

    1. quote from the C++11/C99 standards


    ###c++11

    ###1.3.24 [defns.undefined]

    Undefined behavior; behavior for which this International Standard
    imposes no requirements

    [ Note:

    Undefined behavior may be expected
    when this International Standard omits any explicit definition of
    behavior or when a program uses an erroneous construct or erroneous
    data.

    Permissible undefined behavior ranges from ignoring the situation completely with unpredictable results, to behaving during translation
    or program execution in a documented manner characteristic of the
    environment (with or without the issuance of a diagnostic message), to
    terminating a translation or execution (with the issuance of a
    diagnostic message).

    Many erroneous program constructs do not engender undefined behavior;
    they are required to be diagnosed.

    — end note ]


    ###c99

    3.4.3 – Undefined Behavior

    1. behavior, upon use of a nonportable or erroneous program construct or of erroneous data, for which this >International Standard imposes no requirements

    2. NOTE Possible undefined behavior ranges from ignoring the situation completely with unpredictable results, to behaving during translation
      or program execution
      in a documented manner characteristic of the
      environment (with or without the issuance of a diagnostic message), to
      terminating a translation or execution
      (with the issuance of a
      diagnostic message).

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace

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.