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

C Question

Name: Anonymous 2011-12-02 13:18

Consider the two snipits used to make a struct


//T1
struct b *create_b(...)
{
  struct b *a = malloc(sizeof(struct b));
  ...
  return a;
}

//T2
struct b *create_b(...)
{
  struct b a;
  ...
  return &a;
}


would T2 produce memory errors later on in a program if used a lot? How would it know to when to cleanup a?

Name: Anonymous 2011-12-02 13:23

Use of persistent local variables considered fucking evil.

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