cpg
cpg copied to clipboard
Unexpected C function call representation if function called `new`
I have the following C code:
#include <stdlib.h>
struct s {
int a;
};
typedef struct s S;
S* new() {
return malloc(sizeof(S));
}
void fun() {
S *sptr = new();
}
I've used the Neo4j tool to get an idea to get an idea how the code looks:
The large node is a CallExpression
. It should represent the function call to new()
.
What is surprising is:
- function call is in the function
fun()
. Why isn't the node part of the EOG offun
? - the function code contains as code only
()
. What happened to its name?
The problem goes away, when the function isn't called new()
if that helps. However, new()
is a valid C function name without special meaning afaik.