Debug why does size_t not work as a data member?
<p>Can somebody tell me why the first program crashes, yet the second one doesn't?
First one (crashes):</p>

<pre><code>#include &lt;cstdlib&gt;
class test
{
public:
    test(const char *cstr)
    {
        size_t j=0;
        while(cstr[n++])
            ;
        //n = j;
    }
private:
    size_t n;
};

int main()
{
    test("Hello, world!\n");
    return 0;
}
</code></pre>

<p>Second one does not crash (use variable local to the constructor rather than data member to count):</p>

<pre><code>   #include &lt;cstdlib&gt;
    class test
    {
    public:
        test(const char *cstr)
        {
            size_t j=0;
            while(cstr[j++])
                ;
            n = j;
        }
    private:
        size_t n;
    };

    int main()
    {
        test("Hello, world!\n");
        return 0;
    }
</code></pre>

<p>Running MinGW on windows.
make: <em>*</em> [run] Error -1073741819</p>
