Skip to main content
Mario's user avatar
Mario's user avatar
Mario's user avatar
Mario
  • Member for 13 years, 4 months
  • Last seen this week
awarded
awarded
awarded
awarded
Loading…
answered
Loading…
comment
malloc in caller, free in callee
Add mentioned, it's fine, but not always the best approach. If it's hard to determine the required lifetime (e.g. asynchronous task), I'd add some kind of optional callback you can pass, which would then take cleanup responsibility.
awarded
awarded
answered
Loading…
awarded
awarded
awarded
comment
How do I document my code for minimum time review?
@MatthieuM. Well, that's also part of the crux. ;) For example, a signature bool MyImage::loadFromStream(std::istream &stream); is nice, but the name is more complex than it has to be, since the argument talks for itself. So it's save to just use bool MyImage::load(std::istream &stream); But always keep in mind that names are typically just a human thing. After optimization most names become addresses (if at all), no matter how long the original name was.
revised
Loading…
awarded
awarded
awarded
awarded
Loading…