Udostępnij przez


Ostrzeżenie kompilatora (poziom 1) C4047

"operator" : "identifier1" różni się w poziomie pośrednim od "identifier2"

Uwagi

Wskaźnik może wskazywać zmienną (jeden poziom pośredni), do innego wskaźnika wskazującego zmienną (dwa poziomy pośrednia) itd.

Przykłady

Poniższy przykład generuje kod C4047:

// C4047.c
// compile with: /W1

int main() {
   char **p = 0;   // two levels of indirection
   char *q = 0;   // one level of indirection

   char *p2 = 0;   // one level of indirection
   char *q2 = 0;   // one level of indirection

   p = q;   // C4047
   p2 = q2;
}

Poniższy przykład generuje kod C4047:

// C4047b.c
// compile with: /W1
#include <stdio.h>

int main() {
   int i;
   FILE *myFile = NULL;
   errno_t  err = 0;
   char file_name[256];
   char *cs = 0;

   err = fopen_s(&myFile, "C4047.txt", "r");
   if ((err != 0) || (myFile)) {
      printf_s("fopen_s failed!\n");
      exit(-1);
    }
   i = fgets(file_name, 256, myFile);   // C4047
   cs = fgets(file_name, 256, myFile);   // OK
}