Need help understanding part of armon’s libart via /r/learnprogramming


Need help understanding part of armon’s libart

Hi, I'm currently a CS undergrad. I'm trying to go through and understand how libart works to try and expand my knowledge of data structures.

The main point of confusion I have is about how he's allocating the nodes. It seems to me like he's doing some kind of polymorphism. The code is here http://ift.tt/2t5EaO2

Notice how the function is returning a pointer to the typedefed (http://ift.tt/2tA1kj0) art_node struct, but the size that it's callocing is the art_node<size> struct (defs start at http://ift.tt/2t63oMm) which is defined to contain an art_node inside of it.

So is this some kind of "polymorphic struct"? I can't find anything online describing/defining this behavior in C99.

Submitted July 10, 2017 at 11:33AM by seqwe
via reddit http://ift.tt/2t5E7lr

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s