home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.arch      Apparently more than just beeps & boops      131,241 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 130,160 of 131,241   
   Niklas Holsti to Michael S   
   Re: branch splitting   
   06 Nov 25 12:11:54   
   
   From: niklas.holsti@tidorum.invalid   
      
   On 2025-11-06 11:43, Michael S wrote:   
   > On Wed, 5 Nov 2025 17:26:44 +0200   
   > Niklas Holsti  wrote:   
   >   
   >> On 2025-11-05 7:17, Anton Ertl wrote:   
   >>   
   >>      [ snip ]   
   >>   
   >>> Yes, assigned goto and labels-as-values (and probably the Cobol   
   >>> alter/goto and PL/1 label variables) are there because computer   
   >>> architectures have indirect branches and the programming language   
   >>> designer wanted to give the programmers a way to express what they   
   >>> would otherwise have to express in assembly language.   
   >>>   
   >>> Why does standard C not have it?  C had it up to and including the   
   >>> 6th edition Unix <3714DA77.6150C99A@bell-labs.com>, but it went away   
   >>> between 6th and 7th edition.  Ritchie wrote   
   >>> <37178013.A1EE3D4F@bell-labs.com>:   
   >>>   
   >>> | I eliminated them because I didn't know what to say about their   
   >>> | semantics.   
   >>>   
   >>> Stallman obviously knew what to say about their semantics when he   
   >>> added labels-as-values to GNU C with gcc 2.0.   
   >>   
   >>   
   >> I don't know what Stallman said, or would have said if asked, but I   
   >> guess something like "the semantics is a jump to the (address of the)   
   >> label to which the value refers", which is machine-level semantics   
   >> and not semantics in the abstract C machine.   
   >>   
   >> The problem in the abstract C machine is a "goto label-value"   
   >> statement where the label-value refers to a label in a different   
   >> function. Does gcc prevent that at compile time? If not, I would   
   >> expect the semantics to be Undefined Behavior, the usual cop-out when   
   >> nothing useful can be said.   
   >   
   > Yes, UB sounnds as the best answer..   
      
   The point is that Ritchie was not satisfied with that answer, which is   
   why he removed labels-as-values from his version of C. I doubt that   
   Stallman had any better answer for gcc, but he did not care.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca