Qbasicnews.com
September 19, 2018, 12:41:36 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: GCC help  (Read 6099 times)
wallace
Wandering Guru
***
Posts: 368



WWW
« on: November 29, 2006, 07:28:30 PM »

Is there a way to have a struct hold an pointer to an instance of itself?


Code:
typedef struct{
     int size;
     int blocksize;
     cache *subcache;
} cache;


I know that this code doesn't work, is there a trick to doing it somehow?
Logged

f you play a Microsoft CD backwards you can hear demonic voices.  The scary part is that if you play it forwards it installs Windows.
thegrogen
Ancient QBer
****
Posts: 444



« Reply #1 on: November 30, 2006, 12:08:51 AM »

Code:

typedef struct _cache{
     int size;
     int blocksize;
     cache *subcache;
} cache;


Try that. If it doesn't work, it's because I've been coding deprived for a while.
Logged

.14159265358979323846264338327950288419716939937510582709445
Glarplesnarkleflibbertygibbertygarbethparkentalelelangathaffendoinkadonkeydingdonkaspamahedron.
wallace
Wandering Guru
***
Posts: 368



WWW
« Reply #2 on: November 30, 2006, 12:04:36 PM »

Looks like you're code deprived, it doesn't work  :b

It's ok, I used to be good at C too, anyone else got an idea?
Logged

f you play a Microsoft CD backwards you can hear demonic voices.  The scary part is that if you play it forwards it installs Windows.
Zap
Been there, done that
*****
Posts: 1124


« Reply #3 on: November 30, 2006, 12:32:14 PM »

Have you tried just doing this:

Code:
typedef struct cache{
     int size;
     int blocksize;
     cache *subcache;
} cache;


?

It works for me anyway.
Logged

url=http://www.copy-pasta.com]CopyPasta[/url] - FilePasta
wallace
Wandering Guru
***
Posts: 368



WWW
« Reply #4 on: November 30, 2006, 12:41:50 PM »

Yeah, I tried that, I got a parse error, same as the one with the underscore.
Logged

f you play a Microsoft CD backwards you can hear demonic voices.  The scary part is that if you play it forwards it installs Windows.
shiftLynx
Wandering Guru
***
Posts: 340



WWW
« Reply #5 on: November 30, 2006, 01:06:19 PM »

Code:

typedef struct cache_st
{
    int size;
    int blocksize;
    struct cache_st* subcache;
} cache_t;
Logged

img]http://www.cdsoft.co.uk/misc/shiftlynx.png[/img]
wallace
Wandering Guru
***
Posts: 368



WWW
« Reply #6 on: November 30, 2006, 04:28:04 PM »

That's it.

Thanks.
Logged

f you play a Microsoft CD backwards you can hear demonic voices.  The scary part is that if you play it forwards it installs Windows.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!