Snippets

TeamCOINSE CAVM/Anti-patterns

Created by JUNHWI KIM last modified
void case1(int a, int b, int c) {
  if (a > 0 && b > 0 && c > 0) {
    if (a + b == c * c) {
      return;
    } else {
      return;
    }
  } else {
    return;
  }
}
typedef struct _data {
  int* internal;
  int a, b;
  struct _data* next;
} Data;

void case2(Data* d) {
  if (d == 0 || d->internal == 0) return;

  if (d->a == 1 && d->b == 2) {
    return;
  } else {
    return;
  }
}
1
2
3
4
5
6
7
8
void case3(int a) {
  int b = 10;
  if (a == b) {
    return;
  } else {
    return;
  }
}
1
2
3
4
5
6
7
8
#include <string.h>
void case4(char* str) {
  if (strcmp(str, "Hello") == 0) {
    return;
  } else {
    return;
  }
}
1
2
3
4
5
6
7
8
int _5() { return 10; }
void case5(int a) {
  if (a == _5()) {
    return;
  } else {
    return;
  }
}
typedef struct _data {
  int* internal;
  int a, b;
  struct _data* next;
} Data;

void case6(Data *d) {
  Data *d_in;
  d_in = d->next;
  if (d_in->a == 2) {
    return;
  } else {
    return;
  }
}

Comments (0)