So should I enable Nim's soft realtime GC for everything and then use `ptr` 
where I want to manage memory myself? Is that the default, what should I do to 
use it?

Can I compile using C99 to be able to use the `restrict` keyword with `emit`?

As an example, this is how I implemented one batch processor in C99 that can be 
used by any of the worker threads that picks it up (that is available for work):
    
    
    void waves_integrate(XRESTRICT(waves_t*) waves) {
      
      size_t wave_index = 0;
      
      XRESTRICT(float*) velocities = waves->velocity;
      XRESTRICT(float*) last_heights = waves->last_height;
      XRESTRICT(float*) target_heights = waves->target_height;
      
      for(wave_index = 0; wave_index < WAVE_COUNT; wave_index++) {
        
        // Load
        float velocity = velocities[wave_index];
        float last_height = last_heights[wave_index];
        float target_height = target_heights[wave_index];
        
        // Transform
        float force = (TENSION * (target_height - last_height) - velocity * 
DAMPENING);
        
        // Store
        last_heights[wave_index] = last_height + velocity + force;
        velocities[wave_index] = velocity + force;
      
      }
    
    }
    
    
    Run

Here `XRESTRICT` is replaced by the `restrict` keyword that the C compiler 
supports. The `waves_t*` argument is a pointer to one of the batches.

Sorry for the C code, but I just want to know if I can do this in Nim.

Reply via email to