I am using Nim on embedded system, so RAM is quite precious.

If we do following in C:
    
    
    const int a[] = {1,2,3};
    
    
    Run

a will be stored in ROM, and no RAM is consumed.

While in Nim, if we declare it in a let statement:
    
    
    let a = [1,2,3]
    
    
    Run

a will be allocated in RAM, and its content is initialized (copied from ROM) in 
startup. If we declare it in a const statement, then we are not allowed to get 
its address. But I need this address to call other C functions.

For C backend, is it possible to make let variables read-only and eliminate the 
copy operation? 

Reply via email to