delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/01/06/14:36:45

From: dontmailme AT iname DOT com (Steamer)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: "internal compiler error"
Date: Sat, 06 Jan 2001 19:26:27 GMT
Organization: always disorganized
Lines: 37
Message-ID: <3a577144.7807328@news.freeserve.net>
References: <T3J56.3826$fj6 DOT 312051 AT bgtnsc05-news DOT ops DOT worldnet DOT att DOT net>
NNTP-Posting-Host: modem-78.domino-damsel.dialup.pol.co.uk
X-Trace: news6.svr.pol.co.uk 978809188 8150 62.136.255.78 (6 Jan 2001 19:26:28 GMT)
NNTP-Posting-Date: 6 Jan 2001 19:26:28 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Dennis Cartwright wrote:

>   The following code is from the beginning stages of a prog I am
> writing to simulate a "hold em" poker game.
>   When I compile with gcc -c PokerA.cpp, I get the following error
> message:
> 
> PokerA.cpp In method void Table::firstDeal()':
> Pokeraccpp : 146: Internal compiler error in `find_function_data' at
> function c:542
> Please submit a full bug report
> See http://www.gnu.org/software/gcc/faq.html#bugreport
> 
> Before I attempt to submit a bug report, does anyone see an error in my
> code that I might be overlooking, or does anyone see a workaround I might
> put in?

Your code is wrong.  But, of course, internal compiler errors
shouldn't occur even for incorrect code.

> #include <stdlib.h>
> #include <time.h>
> #include <iostream>
> 
> int NP;                // number of players
[snip lots of code]
> class Table {
>   private:
>     Player p[NP];

Here's the problem.  The value of NP isn't known (and NP
isn't even const), so you can't define the structure of
a class in terms of it.  One solution would be to make
Table::p a std::vector<Player>, and initialize it to the
correct size in the constructor.  Another solution is to
make Table::p a pointer and allocate some memory for it
in the constructor (and delete it in the destructor).

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019