Nichstack

Nichstack

Share this post

Nichstack
Nichstack
A gentle introduction to C* VIII
Copy link
Facebook
Email
Notes
More

A gentle introduction to C* VIII

Let us dig deep into the transient variable lifetimes that power law enforcement in C*.

Alexander Nicholi's avatar
Alexander Nicholi
Aug 22, 2023
∙ Paid
1

Share this post

Nichstack
Nichstack
A gentle introduction to C* VIII
Copy link
Facebook
Email
Notes
More
Share

Welcome to part seven of A gentle introduction to C*. Today’s instalment is a special one, where we will finally dig into the details of how law enforcement is actually carried out in C*.

Let us have a program in C*:

typedef uint32_t myint;

/* Must be less than 100 and cannot ever equal 17 */
law : myint
{
   _ < 100;
   _ != 17;
};

/* Fibonacci sequence will satisfy both of those constraints, but how
 * do we know? */
void fibonacci( void )
{
   uint32_t i, n;
   myint t0, t1;
   uint32_t tn;

   t0 = 0;
   t1 = 1;

   /* print the first two terms */
   fprintf(stdout, "Fibonacci series: %d, %d", t0, t1);

   /* print 3rd to 12th terms */
   for(i = 2; i < 12; ++i)
   {
      tn = t0 + t1;
      fprintf(stdout, ", %d", tn);
      t0 = t1;
      t1 = tn;
   }
}

Going through the Fibonacci sequence, we know that if we limit the number of terms to 12, we will never reach 100. But how does the C* compiler break this down?

Keep reading with a 7-day free trial

Subscribe to Nichstack to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Alexander Nicholi
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share

Copy link
Facebook
Email
Notes
More