Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
unidef freeman
Sep 18, 2014

by R. Guyovich
Mods please close if this is too spammy

But I have a quantum organization library I can’t figure out how correctly use #ifdefs. when I compile the test code it recursively reads the headers

The code is at https://github.com/unidef/quantum

Feel free to openly mock my code, I will cry and tell my cat because my cat went to marine school and my cat is cool

Adbot
ADBOT LOVES YOU

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.
lolololol

a) use pragma once or include guards.

b) i think more people will get the joke if you write this with javascript.

unidef freeman
Sep 18, 2014

by R. Guyovich

Bruegels Fuckbooks posted:

lolololol

a) use pragma once or include guards.

b) i think more people will get the joke if you write this with javascript.

So ifdef a set of libraries, then #define the keyword from the ifdef when you need to use the libraries?


Like

code:
#ifdef quantum 
#include // etc etc system library
#endif


Main.c
#define quantum 
 Int main()
{
Printf(“complete”);
}

Also how do I use pragma?

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

unidef freeman posted:

So ifdef a set of libraries, then #define the keyword from the ifdef when you need to use the libraries?


Like

code:
#ifdef quantum 
#include // etc etc system library
#endif


Main.c
#define quantum 
 Int main()
{
Printf(“complete”);
}

Also how do I use pragma?

Example include guard:
code:
#ifndef GRANDPARENT_H
#define GRANDPARENT_H

struct foo {
    int member;
};

#endif /* GRANDPARENT_H */
What this does is if GRANDPARENT_H is defined, the include (and all the rest of the file up until the endif) is skipped. If GRANDPARENT_H is not defined, then it will be defined, and whatever the header does will happen - but only once, as the next time the file is included, GRANDPARENT_H will be defined so the header will be skipped.

#pragma once works the same way. If you just put #pragma once at the top of the header file, the header will only be processed once. All you have to do is have the text on a line at the top #pragma once.

I would just use the include guards tbh.

MrMoo
Sep 14, 2000

Why is there a trash folder?

unidef freeman
Sep 18, 2014

by R. Guyovich

Bruegels Fuckbooks posted:

Example include guard:
code:
#ifndef GRANDPARENT_H
#define GRANDPARENT_H

struct foo {
    int member;
};

#endif /* GRANDPARENT_H */
What this does is if GRANDPARENT_H is defined, the include (and all the rest of the file up until the endif) is skipped. If GRANDPARENT_H is not defined, then it will be defined, and whatever the header does will happen - but only once, as the next time the file is included, GRANDPARENT_H will be defined so the header will be skipped.

#pragma once works the same way. If you just put #pragma once at the top of the header file, the header will only be processed once. All you have to do is have the text on a line at the top #pragma once.

I would just use the include guards tbh.

What are include guards? I figured out ifdefs and added #pragma and it fixed the infinite header lookup. but the main function (quantum.c) says it can’t find a typedef in type.h, the DOC type in lib/quantum.h

unidef freeman
Sep 18, 2014

by R. Guyovich

MrMoo posted:

Why is there a trash folder?

It’s a place where you can see unused code by other developers, kind of like a cache

It’s also a reference from the 1992 movie “Hackers”

timick
Apr 7, 2016


OP, I find it cute that you decided to commit the temp files, and a directory with old versions of temp files and a binary.

Adbot
ADBOT LOVES YOU

Careful Drums
Oct 30, 2007

by FactsAreUseless

unidef freeman posted:

It’s a place where you can see unused code by other developers, kind of like a cache

It’s also a reference from the 1992 movie “Hackers”

1995, ahctually

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply