Communities

IMECC
IMECC
MA111
MA211
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Procurar help
Notifications
Mark all as read See all your notifications »
Q&A

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

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

0 answers

Sign up to answer this question »