Teste de "syntax highlighting"
+0
−0
Teste de "syntax highlighting":
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#define KNOWN_GARBAGE ((int*)~0u)
int main (void)
{
int* ptr = KNOWN_GARBAGE;
ptr = malloc(0);
int errno_changed = errno;
if(ptr == NULL)
puts("Returned NULL.");
else if(ptr == KNOWN_GARBAGE)
puts("Didn't modify the pointer, non-conforming?");
else
puts("Returned non-zero, modified the pointer.");
if(errno_changed)
printf("Weird use of errno detected, error code 0x%X\n", errno_changed);
}
copiado de: https://software.codidact.com/posts/292694
0 comment threads