Name field for debugging

(Matthew Howard) #1

“The The name field is for easier debugging. A copy of the name is made internally.”

What does that mean? How does the name help with debugging? Where is the name supposed to go?

(Matthew Mc Govern) #2

You’ll notice many structures have a superfluous ‘name’ field, which is passed into the constructor and copied into the struct. This can be useful in GDB if you want to keep straight what is what, since each structure will have a nice name that you have to set when you create the struct. You can print them (the exact command escapes me at the moment, but you could look it up) in GDB when you are poking around the struct.

Protip: These strings take up a lot of memory when you add them all up.