Moving the kernel to modern C
Moving the kernel to modern C
Posted Feb 25, 2022 11:28 UTC (Fri) by jem (subscriber, #24231)In reply to: Moving the kernel to modern C by wtarreau
Parent article: Moving the kernel to modern C
You can add this to the list of things you hate about Rust, too. In Rust you can even do this:
fn main() {
    let i = 0;
    println!("{}", i);    // Prints 0.
    
    let i = i+1;
    println!("{}", i);    // Prints 1.
}
Note that the i variables are immutable ("const") and there are two of them. The second let introduces a new variable which is initialized with the value i+1, where i refers to the first variable.
      Posted Feb 28, 2022 8:09 UTC (Mon)
                               by geert (subscriber, #98403)
                              [Link] (3 responses)
       
     
    
      Posted Feb 28, 2022 9:38 UTC (Mon)
                               by marcH (subscriber, #57642)
                              [Link] (1 responses)
       
     
    
      Posted Feb 28, 2022 10:09 UTC (Mon)
                               by Cyberax (✭ supporter ✭, #52523)
                              [Link] 
       
     
      Posted Feb 28, 2022 11:26 UTC (Mon)
                               by taladar (subscriber, #68407)
                              [Link] 
       
The alternative isn't really any better, coming up with extra names for what is logically the same value. 
     
    Moving the kernel to modern C
      
I still cannot rely on the constant i being constant over the full range of the block, as anyone can have inserted one or more redefinitions in the middle of the block.
Moving the kernel to modern C
      
Moving the kernel to modern C
      
Moving the kernel to modern C
      
           