Mail Archives: djgpp/2000/04/20/03:43:05
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 -