www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/20/03:43:05

From: "Alexandre Devaure" <Alexandre DOT Devaure AT leroy-autom DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <fAeL4.1879$_d1 DOT 3770486 AT nnrp4 DOT proxad DOT net> <8dk3aa$m6a$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <9LgL4.1906$D21 DOT 3649551 AT nnrp4 DOT proxad DOT net> <8dkfaj$rk1$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <XljL4.1955$C91 DOT 3755056 AT nnrp4 DOT proxad DOT net> <8dkh60$sjr$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>
Subject: Re: 'volatile' undeclared from here
Lines: 88
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Message-ID: <ktyL4.2008$hy.2487363@nnrp6.proxad.net>
Date: Thu, 20 Apr 2000 07:37:52 GMT
NNTP-Posting-Host: 194.51.236.59
X-Complaints-To: abuse AT proxad DOT net
X-Trace: nnrp6.proxad.net 956216272 194.51.236.59 (Thu, 20 Apr 2000 09:37:52 CEST)
NNTP-Posting-Date: Thu, 20 Apr 2000 09:37:52 CEST
Organization: Guest of ProXad - France
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de> a écrit dans le
message : 8dkh60$sjr$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE...

> That's a bit strange. I compiled your code (as a .cc file, directly,
> as you hadn't provided the main source file, nor any other module), on
> a Linux installation of gcc-2.95.2, and it accepted it without any
> complaints. Which means this is either a problem with the DJGPP build
> of gcc-2.95.2, or the actual problem is elsewhere in your program,
> i.e.  in those parts you didn't show.
>
> Could you try and cut down the source to the absolute minimum that
> still reports that compiler error, and post the result?
>

This is the source code that reports the compiler error. It seems to be a
problem with the template in the class TValueFifo. When I comment out the
template declaration, the compiler accepts the source code.

#include "ports.h"

#include <stdio.h>

class bidon
{
        int toto;
public:
        int flags()
        {
                return toto;
        }
};
#include <i8086.h>

template<class T, unsigned Size>
class TValueFifo
{
private:
 unsigned Head;
 unsigned Tail;
 unsigned Count;
        unsigned char Buffer[Size*sizeof(T)];
        unsigned char Buffer[1024];

public:
 int Empty() { return !Count; }
 int Full() { return Count==1024; }
        // int Put(const T& Value)
        int Put(const bidon& Value)
        {
                if (!Full())
  {
                        //   ((T*)Buffer)[Head]= Value;
                        ((bidon*)Buffer)[Head]=Value;
   if (Head>=1024-1)
    Head=0;
   else
    Head++;
   Count++;
   return 0;
  }
  return 1;
 }
        int PutSecure(const T& Value)
        int PutSecure(const bidon& Value)
        {
                __asm__ __volatile__("pushf");
  int Error = Put(Value);
  popf();

  return Error;
 }

 TValueFifo() : Head(0), Tail(0), Count(0) {}
};

TValueFifo <bidon,2> obj;

int main()
{
        bidon b;
        int i=obj.PutSecure(b);
}


Alex


- Raw text -


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