Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Bugs

Archive::Bugs Archive area for Bugs's posts that were moved here after an inactivity period of 90 days.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 11-13-2003, 03:52 PM
Edgar1898
Senior Member
Former EQEmu Developer
Current EQ2Emu Lead Developer
 
Join Date: Dec 2002
Posts: 1,065
Default

that wont work under any true c++ compiler because arrays such as that must be declared with a constant size. VS .NET will not allow it.

Example:


Quote:
<kathgar> #include <iostream>
<kathgar> #include <string>
<kathgar> using namespace std;
<kathgar> int main()
<kathgar> {
<kathgar> int b;
<kathgar> cin >> b;
<kathgar> char buffer[b];
<kathgar> for(int x = 0; x < b; x++)
<kathgar> buffer[x] = 'A';
<kathgar> for(int x = 0; x < b; x++)
<kathgar> cout << buffer[x];
<kathgar> cout << ' ';
<kathgar> cout << sizeof(buffer) << endl;
<kathgar> return 0;
<kathgar> }
<kathgar> kathgar@enigma-interactive:~$ g++ -o buffer buffer.cpp
<kathgar> kathgar@enigma-interactive:~$
compiled fine with a standard c compiler, but not with a true C++ compiler:

Code:
c:\test\blah.cpp(8): error C2057: expected constant expression
c:\test\blah.cpp(8): error C2466: cannot allocate an array of constant size 0
c:\test\blah.cpp(8): error C2133: 'buffer' : unknown size
c:\test\blah.cpp(14): error C2070: 'char []': illegal sizeof operand
(Same program in VS)
__________________
Lethal Encounter
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 11:15 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3