CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2009
    Posts
    24

    Question dynamic arrays WITHOUT pointers are legal???

    I for some reason can have a variable sized array. For example main.cpp (it's an attachment) can compile & run perfectly! Can someone tell me why it works and how it doesn't say it works on all the tutorials.
    Attached Files Attached Files

  2. #2
    Join Date
    Jun 2006
    Location
    M31
    Posts
    885

    Re: dynamic arrays WITHOUT pointers are legal???

    Quote Originally Posted by E-man96 View Post
    Can someone tell me why it works and how it doesn't say it works on all the tutorials.
    This is only standard in C99. When it comes to C++, it's a compiler extension.

  3. #3
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: dynamic arrays WITHOUT pointers are legal???

    I have not looked through the attachment, but my first guess is that you are using the variable length array extension ported to g++ from gcc's implementation of C99. As such, it is not part of standard C++.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  4. #4
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: dynamic arrays WITHOUT pointers are legal???

    As always, "it works" is not the same as "it's legal".

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured