Does the aliasing loophole apply to signed characters?What are the differences between a pointer variable and a reference variable in C++?What does the explicit keyword mean?When to use reinterpret_cast?How do I use arrays in C++?C++11 introduced a standardized memory model. What does it mean? And how is it going to affect C++ programming?Image Processing: Algorithm Improvement for 'Coca-Cola Can' RecognitionEfficient unsigned-to-signed cast avoiding implementation-defined behaviorReplacing a 32-bit loop counter with 64-bit introduces crazy performance deviationsHas a std::byte pointer the same aliasing implications as char*?Does the C++ standard allow for an uninitialized bool to crash a program?

How would a low-tech device be able to alert its user?

What stops you from using fixed income in developing countries?

Can you board the plane when your passport is valid less than 3 months?

How is linear momentum conserved in case of a freely falling body?

50-move rule: only the last 50 or any consecutive 50?

Are game port joystick button circuits more than plain switches? Is this one just faulty?

Can Orcus use Multiattack with any melee weapon?

Convergence of series of normally distributed random variables

Light Themed Cryptic

Does EU 261/2004 compensation apply if delayed by the border check?

Why error propagation in CBC mode encryption affect two blocks?

Why is proof-of-work required in Bitcoin?

Did anybody find out it was Anakin who blew up the command center?

How many lines of code does the original TeX contain?

What is the loud noise of a helicopter when the rotors are not yet moving?

Can I get a PhD for developing an educational software?

Breaker Mapping Questions

What should come first—characters or plot?

Joining lists with same elements

How were medieval castles built in swamps or marshes without draining them?

Make utility using LINQ

Can an ISO file damage—or infect—the machine it's being burned on?

Changing JPEG to RAW to use on Lightroom?

Is the negative potential of 書く used in this sentence and what is its meaning?



Does the aliasing loophole apply to signed characters?


What are the differences between a pointer variable and a reference variable in C++?What does the explicit keyword mean?When to use reinterpret_cast?How do I use arrays in C++?C++11 introduced a standardized memory model. What does it mean? And how is it going to affect C++ programming?Image Processing: Algorithm Improvement for 'Coca-Cola Can' RecognitionEfficient unsigned-to-signed cast avoiding implementation-defined behaviorReplacing a 32-bit loop counter with 64-bit introduces crazy performance deviationsHas a std::byte pointer the same aliasing implications as char*?Does the C++ standard allow for an uninitialized bool to crash a program?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








9















In C++ there is an aliasing loophole which allows the object representation of any object to be read or written through some pointers of character type.



Does this apply only to char and unsigned char or also to signed char?










share|improve this question
































    9















    In C++ there is an aliasing loophole which allows the object representation of any object to be read or written through some pointers of character type.



    Does this apply only to char and unsigned char or also to signed char?










    share|improve this question




























      9












      9








      9








      In C++ there is an aliasing loophole which allows the object representation of any object to be read or written through some pointers of character type.



      Does this apply only to char and unsigned char or also to signed char?










      share|improve this question
















      In C++ there is an aliasing loophole which allows the object representation of any object to be read or written through some pointers of character type.



      Does this apply only to char and unsigned char or also to signed char?







      c++ language-lawyer






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 8 hours ago









      StoryTeller

      118k18 gold badges253 silver badges320 bronze badges




      118k18 gold badges253 silver badges320 bronze badges










      asked 8 hours ago









      BeeOnRopeBeeOnRope

      29.5k9 gold badges97 silver badges199 bronze badges




      29.5k9 gold badges97 silver badges199 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          12















          No, the provision does not extend to signed char.




          [basic.lval]



          8 If a program attempts to access the stored value of an object
          through a glvalue of other than one of the following types the
          behavior is undefined:



          • [...]

          • a char, unsigned char, or std​::​byte type.



          The quote above contains the very last bullet that pertains to aliasing with character types. signed char is excluded.



          Nevertheless, this is also part of the subject CWG Issue 350 deals with, and so may change. Given the direction the issue has taken, the intent is for it to be (eventually, hopefully?) well-defined.






          share|improve this answer



























          • That's quite interesting. Why is char allowed, which is signed on my machine, but not signed char? But that's probably the reason why they want to add it in an upcoming standard.

            – mch
            8 hours ago











          • @mch - Could be an editorial mistake. I can only guess, really.

            – StoryTeller
            8 hours ago






          • 3





            @mch It's because in some cases, the standard does not allow char to be signed. For example, trap representations are allowed in all signed types, so a signed char may not be able to represent every byte, and char would have to be unsigned.

            – Artyer
            6 hours ago






          • 2





            @Artyer - Can't believe I forgot that. Though it's worth noting that with C++20 moving towards "2's complement only", signed char no longer has place for trap values eel.is/c++draft/basic.fundamental#7.

            – StoryTeller
            6 hours ago










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f57653869%2fdoes-the-aliasing-loophole-apply-to-signed-characters%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          12















          No, the provision does not extend to signed char.




          [basic.lval]



          8 If a program attempts to access the stored value of an object
          through a glvalue of other than one of the following types the
          behavior is undefined:



          • [...]

          • a char, unsigned char, or std​::​byte type.



          The quote above contains the very last bullet that pertains to aliasing with character types. signed char is excluded.



          Nevertheless, this is also part of the subject CWG Issue 350 deals with, and so may change. Given the direction the issue has taken, the intent is for it to be (eventually, hopefully?) well-defined.






          share|improve this answer



























          • That's quite interesting. Why is char allowed, which is signed on my machine, but not signed char? But that's probably the reason why they want to add it in an upcoming standard.

            – mch
            8 hours ago











          • @mch - Could be an editorial mistake. I can only guess, really.

            – StoryTeller
            8 hours ago






          • 3





            @mch It's because in some cases, the standard does not allow char to be signed. For example, trap representations are allowed in all signed types, so a signed char may not be able to represent every byte, and char would have to be unsigned.

            – Artyer
            6 hours ago






          • 2





            @Artyer - Can't believe I forgot that. Though it's worth noting that with C++20 moving towards "2's complement only", signed char no longer has place for trap values eel.is/c++draft/basic.fundamental#7.

            – StoryTeller
            6 hours ago















          12















          No, the provision does not extend to signed char.




          [basic.lval]



          8 If a program attempts to access the stored value of an object
          through a glvalue of other than one of the following types the
          behavior is undefined:



          • [...]

          • a char, unsigned char, or std​::​byte type.



          The quote above contains the very last bullet that pertains to aliasing with character types. signed char is excluded.



          Nevertheless, this is also part of the subject CWG Issue 350 deals with, and so may change. Given the direction the issue has taken, the intent is for it to be (eventually, hopefully?) well-defined.






          share|improve this answer



























          • That's quite interesting. Why is char allowed, which is signed on my machine, but not signed char? But that's probably the reason why they want to add it in an upcoming standard.

            – mch
            8 hours ago











          • @mch - Could be an editorial mistake. I can only guess, really.

            – StoryTeller
            8 hours ago






          • 3





            @mch It's because in some cases, the standard does not allow char to be signed. For example, trap representations are allowed in all signed types, so a signed char may not be able to represent every byte, and char would have to be unsigned.

            – Artyer
            6 hours ago






          • 2





            @Artyer - Can't believe I forgot that. Though it's worth noting that with C++20 moving towards "2's complement only", signed char no longer has place for trap values eel.is/c++draft/basic.fundamental#7.

            – StoryTeller
            6 hours ago













          12














          12










          12









          No, the provision does not extend to signed char.




          [basic.lval]



          8 If a program attempts to access the stored value of an object
          through a glvalue of other than one of the following types the
          behavior is undefined:



          • [...]

          • a char, unsigned char, or std​::​byte type.



          The quote above contains the very last bullet that pertains to aliasing with character types. signed char is excluded.



          Nevertheless, this is also part of the subject CWG Issue 350 deals with, and so may change. Given the direction the issue has taken, the intent is for it to be (eventually, hopefully?) well-defined.






          share|improve this answer















          No, the provision does not extend to signed char.




          [basic.lval]



          8 If a program attempts to access the stored value of an object
          through a glvalue of other than one of the following types the
          behavior is undefined:



          • [...]

          • a char, unsigned char, or std​::​byte type.



          The quote above contains the very last bullet that pertains to aliasing with character types. signed char is excluded.



          Nevertheless, this is also part of the subject CWG Issue 350 deals with, and so may change. Given the direction the issue has taken, the intent is for it to be (eventually, hopefully?) well-defined.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 8 hours ago

























          answered 8 hours ago









          StoryTellerStoryTeller

          118k18 gold badges253 silver badges320 bronze badges




          118k18 gold badges253 silver badges320 bronze badges















          • That's quite interesting. Why is char allowed, which is signed on my machine, but not signed char? But that's probably the reason why they want to add it in an upcoming standard.

            – mch
            8 hours ago











          • @mch - Could be an editorial mistake. I can only guess, really.

            – StoryTeller
            8 hours ago






          • 3





            @mch It's because in some cases, the standard does not allow char to be signed. For example, trap representations are allowed in all signed types, so a signed char may not be able to represent every byte, and char would have to be unsigned.

            – Artyer
            6 hours ago






          • 2





            @Artyer - Can't believe I forgot that. Though it's worth noting that with C++20 moving towards "2's complement only", signed char no longer has place for trap values eel.is/c++draft/basic.fundamental#7.

            – StoryTeller
            6 hours ago

















          • That's quite interesting. Why is char allowed, which is signed on my machine, but not signed char? But that's probably the reason why they want to add it in an upcoming standard.

            – mch
            8 hours ago











          • @mch - Could be an editorial mistake. I can only guess, really.

            – StoryTeller
            8 hours ago






          • 3





            @mch It's because in some cases, the standard does not allow char to be signed. For example, trap representations are allowed in all signed types, so a signed char may not be able to represent every byte, and char would have to be unsigned.

            – Artyer
            6 hours ago






          • 2





            @Artyer - Can't believe I forgot that. Though it's worth noting that with C++20 moving towards "2's complement only", signed char no longer has place for trap values eel.is/c++draft/basic.fundamental#7.

            – StoryTeller
            6 hours ago
















          That's quite interesting. Why is char allowed, which is signed on my machine, but not signed char? But that's probably the reason why they want to add it in an upcoming standard.

          – mch
          8 hours ago





          That's quite interesting. Why is char allowed, which is signed on my machine, but not signed char? But that's probably the reason why they want to add it in an upcoming standard.

          – mch
          8 hours ago













          @mch - Could be an editorial mistake. I can only guess, really.

          – StoryTeller
          8 hours ago





          @mch - Could be an editorial mistake. I can only guess, really.

          – StoryTeller
          8 hours ago




          3




          3





          @mch It's because in some cases, the standard does not allow char to be signed. For example, trap representations are allowed in all signed types, so a signed char may not be able to represent every byte, and char would have to be unsigned.

          – Artyer
          6 hours ago





          @mch It's because in some cases, the standard does not allow char to be signed. For example, trap representations are allowed in all signed types, so a signed char may not be able to represent every byte, and char would have to be unsigned.

          – Artyer
          6 hours ago




          2




          2





          @Artyer - Can't believe I forgot that. Though it's worth noting that with C++20 moving towards "2's complement only", signed char no longer has place for trap values eel.is/c++draft/basic.fundamental#7.

          – StoryTeller
          6 hours ago





          @Artyer - Can't believe I forgot that. Though it's worth noting that with C++20 moving towards "2's complement only", signed char no longer has place for trap values eel.is/c++draft/basic.fundamental#7.

          – StoryTeller
          6 hours ago








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f57653869%2fdoes-the-aliasing-loophole-apply-to-signed-characters%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

          Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

          199年 目錄 大件事 到箇年出世嗰人 到箇年死嗰人 節慶、風俗習慣 導覽選單