If you want to store the size your dynamic array inside it, well, just do so:

#include &lt;iostream&gt;
#include &lt;cstdint&gt;
#include &lt;cstddef&gt;
using std::size_t;

struct head_t { size_t size; int data[]; };

int main() {
    head_t* h = static_cast&lt;head_t*&gt;(::operator new(sizeof(head_t) + 10 * sizeof(int)));
    h-&gt;size = 10;
    int* my_10_ints = h-&gt;data;
    // Oh noez! I forgot 10!
    size_t what_was_10_again = static_cast&lt;head_t*&gt;(static_cast&lt;void*&gt;(my_10_ints) - offsetof(head_t, data))-&gt;size;
    ::std::cout &lt;&lt; what_was_10_again &lt;&lt; "\n";
    ::operator delete(static_cast&lt;void*&gt;(my_10_ints) - offsetof(head_t, data));
}


You can even put that functionality in a libraryesque set of functions! Oh, and once you do that you realize you could just have an unordered_map that maps pointers to sizes. But that would be like using vector: Totally boring.

Size of dynamic array or loop through it without knowing size
I use the following line to find all sub-directories of the PWD and run svnadmin verify on each directory (I already know that they're Subversion repositories)

find ./* -maxdepth 0 -exec svnadmin verify {} \;


This works well, other than the fact that the output looks like this:

* Verifying repository metadata ...
* Verifying metadata at revision 1 ...
* Verifying metadata at revision 2 ...
* Verifying metadata at revision 4 ...
* Verifying metadata at revision 5 ...
* Verifying metadata at revision 6 ...
* Verifying metadata at revision 9 ...
* Verifying metadata at revision 10 ...
* Verifying metadata at revision 12 ...
* Verifying metadata at revision 14 ...
* Verifying metadata at revision 15 ...
* Verifying metadata at revision 18 ...
* Verifying metadata at revision 20 ...
* Verifying metadata at revision 22 ...
* Verified revision 0.
* Verified revision 1.
* Verified revision 2.
* Verified revision 3.
* Verified revision 4.
* Verified revision 5.
* Verified revision 6.
* Verified revision 7.
* Verified revision 8.
* Verified revision 9.
* Verified revision 10.
* Verified revision 11.
* Verified revision 12.
* Verified revision 13.
* Verified revision 14.
* Verified revision 15.
* Verified revision 16.
* Verified revision 17.
* Verified revision 18.
* Verified revision 19.
* Verified revision 20.
* Verified revision 21.
* Verified revision 22.
* Verified revision 23.
* Verified revision 0.
* Verifying repository metadata ...
* Verifying metadata at revision 4 ...
* Verifying metadata at revision 5 ...
* Verifying metadata at revision 6 ...
* Verifying metadata at revision 7 ...
* Verifying metadata at revision 9 ...
* Verified revision 0.
* Verified revision 1.
* Verified revision 2.
* Verified revision 3.
* Verified revision 4.
* Verified revision 5.
* Verified revision 6.
* Verified revision 7.
* Verified revision 8.
* Verified revision 9.


I'd really like find to print the filename before executing the svnadmin verify command, to make logging easier.

I've tried to squeeze a little ls in there but bodged it up, how should I do this (preferably simply)?
