Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Should we dynamically allocate the MsgInfo objects we store in the msgBuffer queues?

0
Posted

Should we dynamically allocate the MsgInfo objects we store in the msgBuffer queues?

0

A. No. The queue will store copies of what you add to it, so just store a regular MsgInfo object (not a pointer to a dynamically-allocated one). Since a MsgInfo has just a couple fairly-simple data members, storing a copy is fine. And, then you won’t have to deallocate those MsgInfos when you later take them out of a msgBuffer. • Q. How does a template module (i.e., its .tem file) fit into a make file? A. The .tem file gets included in its .h, so draw that as an “include” dependency in your dependency chart. The make file is as usual, one target for the executable, which depends on all the .o files. Then, one target for each .o. Remember, .o are generated from .cpp files, .tem files don’t generate a .o. For a .o dependency list, remember you must list all the files its .cpp includes directly or indirectly. There are alternate ways to break apart the dependencies, but this is consistent with how we did it in lab. • Q. How do we create each NetworkNode? A. Use “new” to create each Networ

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123