Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ul> <li>It's up to you, just doing <code>buffer</code> is more terse but if it were a <code>vector</code>, you'd need to do <code>&amp;buffer[0]</code> anyway.</li> <li>Depends on your intended platform.</li> <li>Does it matter? Have you determined it to be a problem? Write the code that's easiest to read and maintain before you go off worrying if you can obfuscate it into something faster. But for what it's worth, allocation on the stack is very fast (you just change the stack pointer value.)</li> <li>You should be using <code>std::string</code>. If performance becomes a problem, you'd be able to reduce dynamic allocations by just returning the internal buffer. But the <code>std::string</code> return interface is way nicer and safer, and performance is your last concern.</li> <li>That's a memory leak. Many will argue that's okay, since the OS free's it anyway, but I feel it terrible practice to just leak things. Use a static <code>std::vector</code>, you should <em>never</em> be doing any raw allocation! If you're putting yourself into a position where you might leak (because it needs to be done explicitly), you're doing it wrong.</li> <li>I think your (1) and (2) just about cover it. Dynamic allocation is almost always slower than stack allocation, but you should be more concerned about which makes sense in your situation.</li> <li>You shouldn't be using those at all. Use <code>std::string</code>, <code>std::stringstream</code>, <code>std::copy</code>, etc.</li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload