Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 994305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:33:15+00:00 2026-05-16T06:33:15+00:00

I have ported some code from Mingw which i wrote using code::blocks, to visual

  • 0

I have ported some code from Mingw which i wrote using code::blocks, to visual studio and their compiler, it has picked up many errors that my array sizes must be constant! Why does VS need a constant size and mingw does not?

e.g.

const int len = (strlen(szPath)-20);
char szModiPath[len];

the len variable is underlined in red to say that its an error and says “expected constant expression”

The only way i can think to get around this is….

char* szModiPath = new char[len];
delete[] szModiPath;

Will i have to change everything to dynamic or is there another way in VS?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:33:16+00:00Added an answer on May 16, 2026 at 6:33 am

    Why does VS need a constant size and mingw does not?

    Because Variable Length Arrays are not a part of C++ although MinGW(g++) supports them as extension.
    Array size has to be a constant expression in C++.

    In C++ it is always recommended to use std::vector instead of C-style arrays. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have ported some LGPL code from Java to C#, which I plan to
Our team is currently using some ported code from an old architecture to a
I have ported over some code from a Windows application to Monotouch. It is
I'm looking at some code at the moment which has been ported and is
I have a bit of ported code. It was automatically converted from VB6 to
I have ported our project from Delphi 7 to Delphi 2010. After adding some
I am porting some C++ code from Unix to Linux (Red Hat). I have
I have ported a search from Coldfusion into a MySQL stored procedure. The actual
I ported some old code over to Objective-C ARC (Automatic Reference Counting) and it
i have some html files as part of a regular website that has been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.