Bennugd Void * Issues As Type Members And Function Return Types


sam fisher

Well-Known Member
Joined
Apr 11, 2004
Messages
9,452
Location
Bristol, UK
Website
blog.peter-r.co.uk
I've recently started looking at BennuGD and got to the point where it would be convenient to have a linked list. So, I've tried to implement a generic linked list using void * for the stored items but this has led to a couple of issues.

Firstly, I couldn't get the code to compile with a type containing a void * element but I managed to work around this by first defining a type containing nothing by a void element. I have no idea why this worked and since the compiler error was a syntax / parsing error I can think of no good reason why this should work :S.

Secondly, I have not managed to successfully compile code that contains a function that returns a void * and I've tried an analogous work around to the above, defining a function returning type void, but that didn't work. Currently I'm working around this by returning an int * and doing some nasty type cast mangling but I don't think I should need to do this.

Has anyone else run into similar issues to these?
 
Which compiler are you using? I compiled a small example with gcc 4.7.2 and had no issues:
Code:
class CTest
{
public:
  CTest()
  : m_number(0),
    m_pointer(0)
  {}
 
private:
  int m_number;
  void* m_pointer;
};

void* MyFun(int i)
{
  return 0;
}

int main (int argc, char* argv[])
{
  CTest myTest;
  MyFun(0);
  return 0;
}

Can you give a minimum example that doesn't work for you?
 
I can successfully compile bennugd on the OMAP5 devboard as I ported Streets of Rage Remake not too long ago for the Pyra.

gcc version.
Code:
gcc (Debian 6.3.0-18) 6.3.0 20170516

I do see some Warnings:
Code:
In file included from moddesc.c:27:0:
/mnt/120g/trashy_dev/bennugd-code/tools/moddesc/../../core/include/loadlib.h:84:12: warning: ‘dlibclose’ defined but not used [-Wunused-function]
 static int dlibclose( void * _handle )
            ^~~~~~~~~
/mnt/120g/trashy_dev/bennugd-code/tools/moddesc/../../core/include/loadlib.h:57:15: warning: ‘dliberror’ defined but not used [-Wunused-function]
 static char * dliberror( void )

I'm not using anything spectacular for compiling flags either.
Code:
 CFLAGS=" -mcpu=cortex-a15 -mfpu=neon -mfloat-abi=hard -funroll-loops -L/usr/lib/arm-linux-gnueabihf/ -L/opt/omap5-sgx-ddk-um-linux/lib -lcrypto -ldl"
 
Back
Top