Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

The C Programming Language

Name: Anonymous 2011-10-24 21:45

Let's have a thread for the C programming language. It's an excellent language.

Name: Anonymous 2011-10-28 5:39

>>50
This pisses me off, clearly the expert solution is:


int
foo (void)
{
  Matrix a = {0},
         b = {0},
         c = {0};
   
  matrix_init (&a, 1000, 1000);
  matrix_init (&b, 1000, 1000);
  matrix_init (&c, 1000, 1000);

  matrix_value_from (&c, &a);
  matrix_multiply_scalar (&c, 2);
  matrix_add (&c, &b);
   
  if (a.error_flag ||
      b.error_flag ||
      c.error_flag)
      goto exit_foo;

  ...

  exit_foo:
    matrix_free (&a);
    matrix_free (&b);
    matrix_free (&c);

    return some_value;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List