@grumpy
Hm. I suppose I'll try learning more about that, then.
Thank you for your help!
Type: Posts; User: MeNeedsHelp
@grumpy
Hm. I suppose I'll try learning more about that, then.
Thank you for your help!
@grumpy
Oh, I see. Thank you very much.
However, I'm still interested to know how to make the code be interpreted, and considering Lua did it in ANSI C, I'm very curious as to how to make it...
@grumpy
OK, but how could I do that with something like Make from within the program?
@grumpy
I don't need it to be interpreted, if I can do the "either that" option, but do you have an example of such a tool? As you said, IDEs like Visual Studio, Eclipse and NetBeans do this, so...
Sorry for being unclear. I'll try to give you a decent example.
Say a text file contains the following code:
func<int> Add(int x, int y)
{ return (x + y); }
structure Container
{ int i;...
I know how C "works". I just made an example, and I meant for it to be interpreted not as C code, but as code for another imaginary language.
void DoSomething(int* x) { (*x) = 42; }
If you...
Hello.
Say that a file contains the following text:
struct Data { int x; };
void DoSomething(int x) { x = 42; }
int main()
All right, thank you for all the help.
(I won't be asking any more questions here, so the thread can be locked.)
Even if I'm working with bits, is it fine to use a function to check if a bit is enabled? Wouldn't that slow the program down?
Oh. I think I understand now, thank you (and sorry for taking up your time).
EDIT:
Slightly off-topic, but I don't really want to make a new thread just for this:
Performance-wise, what is the...
0x01 = 0000 0001
0x02 = 0000 0010
0x04 = 0000 0100
However,
0x03 = 0000 0011
If I just want to switch the bit four times, I would just set "RADIO_ENABLED" to 3 rather than 0x03. If I do it...
OK...
// Base.h
#define LIGHT_ENABLED 0x01
#define ENGINE_ENABLED 0x02
#define RADIO_ENABLED 0x04
#define AC_ENABLED 0x08
I assume you missed my edit, since it wasn't in the quote. My question was (initially, at least) poorly phrased.
In that case, how would you enable, disable, toggle and check if a bit is enabled?
I use this code:
#define EnableBit(var, pos) ((var) |= (1 << (pos - 1)))
#define IsBitEnabled(var, pos)...
So, if I've understood it correctly, it can be used as follows:
// Base.h
#define ENABLE_LIGHT 0x01 // 0000 0001
#define ENABLE_ENGINE 0x02 // 0000 0010
// Main.c
unsigned char settings...
Hello!
When studying OpenGL, I noticed that constants are defined as such:
#define GL_CONSTANT_1 0x01 // 1 = 00000001
#define GL_CONSTANT_2 0x02 // 2 = 00000010
#define GL_CONSTANT_3 0x04...
Thank you, I'll do that.
I am doing this for a project, just to learn. If I wanted the best, I would use something like Python.
I mean, is it possible to compile with GCC without having the user do it themselves - for...
Could I do it if GCC is installed? (MinGW, in this case.) If so, how?
Is there a way to compile it within the program itself? What I want to do is to open a text file with instructions, turn it into C code and then compile it into an executable. I understand how to do...
I am currently trying to make a "new programming language" (the term used VERY loosely) based on C. To do this, I decided to use C to read strings and interpret their contents.
void Read()
{
...
Apparently, I'm not wrong, at least when it comes to variables being placed before any other code - it works fine in VS13E.
Thank you for the help.
If I've understood it correctly, VS 2013 Express should be able to compile C99 code. Am I wrong?
Oh, I see. Is there no way to use C99 or C11 with VS?
That doesn't work - since num is given a value only after ex is created, it doesn't carry over, which is the whole point.