« first day (330 days earlier)      last day (3526 days later) » 

03:01
Yo yo yo
are there any embedded developers present?
Are there times that you purposefully don't initialize non-const variables, so that they don't take up both ROM and RAM space?
 
5 hours later…
07:59
@gtozzi For a non-embedded developer also, that makes sense when u want to save memory usage...
 
6 hours later…
14:00
helloc all;
user3079266
14:20
helloc all;
15:02
helloc fellows :} ;
@gtozzi agree with @haris. In emebedded systems it's a common problem to deal with --- too big RAM and/or ROM consumption. So, that's one way.
actually... most of the cases You can do better just upgrading the compiler. Still the best way would be reviewing the architecture.
 
1 hour later…
16:33
@Kamiccolo Hello world
@Kamiccolo You're around?
 
3 hours later…
19:12
helloc all;
user3079266
helloc @deckard;
user3079266
'sup?
working
actually I have some things I wouldn't mind another opinion
user3079266
@deckard what things?
Ok, so the structure of my project is something like this
algorithm.h
algorithm.c
privatekey.h
privatekey.c
in privatekey, I also declare and define some variables (apart from the said key)
public parameters of the system
Now, I have a test function within the algorithm
So I need some privatekeytest.h
privatekey.c
containing an array of private keys
the problem is, even though I'm using preprocessor #ifdef and so
The compiler links privatekey.o even when privatekey.h is not included
so I get multiple definition error
any idea on how to aviod that?
user3079266
19:35
I'm not sure if I'm following you. What is it that gets double-defined?
user3079266
helloc @sami; //Welcome!
Yep, that was not a very good explanation
ok
8->
I'm writing a cryptographic algorithm
It makes use of certain public parameters and certain private parameters
user3079266
@deckard what do you mean by parameters?
user3079266
19:38
as in function parameters?
variables that affect the computations
key lengths, and that kind of things
user3079266
got it. (All constant, I hope? =p)
yes
Everything is known at compile time
user3079266
and by private, you mean static constants inside .c files?
But can be different (and it is) because you can use different levels of security and so
oh, no. I meant that some of those parameters are public (from a security perspective) and some others are not
as far as the program knows, all are the same
user3079266
19:42
ah, you just mean the stuff that you're using as public and private keys, got it =)
yes
and information regarding key lengths, block length used...
what I have now is the algorithm that just make an #include "privatekey.h"
and gets from there all the information it needs
but now I want to add a test function, this test function will go through an array of privatekeys, generating some keys and checking against a pregenerated table
user3079266
wait, so it looks like this: privatekey.c includes privatekey.h AND privatekeytest.h, which includes privatekey.h?
privatekey.h does not include privatekey.c
privatekey.c includes privatekey.h
user3079266
@deckard that's what I said
=)
I'm declaring the variables on the .h
and defining and initializing them on the .c
user3079266
19:49
@deckard privatekey.h and privatekey.c?
yes
The first time I asked you something here was related to that, not sure if you will remember
user3079266
what's the point of this, exactly? Why can't you init them in privatekey.h if they're constant anyway?
can i?
user3079266
@deckard yep, I do =) this question, right?
@Mints97 exactly
I thought I had to declare them in the .h and define in the .c
user3079266
19:51
so yeah, in any .h file, you can write smt like const int abcd = 100500;...
user3079266
@deckard I wouldn't do this that way, but whatever, go on =) or we won't reach the problem soon
no, it's no problem
I mean, it's nice. I will change that
It's better anyway now I will only have one file
ok
so this is easier now
user3079266
if there's any configuration to be done prior to compilation, like #define's or constants that need to be changed, it's traditionally put into .h files. Sometimes they are made separate files with names like "config.h"
ok
so I would like to have some config.h and config_test.h
those won't be included at the same time
and will have some variables defined in both
user3079266
19:56
is config_test.h a unit test?
user3079266
@deckard maybe you mean constant globals? =P
hmm
i'm kinda lost now
user3079266
variable always means something that can change
user3079266
hence the name, really =)
oh, yeah
they are constant, yes
const int
or whatever
I don't know but in C when I think of constants i picture #define
hence my mistake
but, yes sure, constants
user3079266
20:00
@deckard ...and in should now burst ol' Bartek ranting how global const's are soo much better as constants than #define's because they are TYPESAFE! ;D
user3079266
but yeah, we digress
hahaha
oh
I think I've figured a way
user3079266
so what was the problem anyway? =P
right now, i have (everything global const)
`config.h
const int a = 1;
const int b = 2;
const int c[5] = {1,2,3,4,5};
config_test.h
const int a = 1;
const int b = 2;
const int c[5][10] = {1,2,3,4,5}, {1,2,3,4,5}, ... ;`
when I include one of them, the compiler throws an error (or it did, when I was using the .h and .c)
user3079266
soo, there's some file that includes them both?
user3079266
20:09
or one includes the other?
nope
but, i can put the public parameters in a config.h file
(those are the ones that got multiple define)
and put the private keys in another header
by doing that I think I won't have that problem anymore
user3079266
aaach, I don't understand! What causes the multiple define error for you?
I'll check
problem is, I don't know why
the linker automatically tries to link everything on the project
so even though it was not included, the linker was linking both
and including the two of them at the same time was causing an error
anyway, how are your us universities?
user3079266
oh, good, thanks! I got accepted to the Georgia Institute of Technology (GaTech.edu), ranked 4th in Engineering in the U.S. =P
20:26
wow
that's really nice!
congratulations!
user3079266
thanks =P
when are you starting?
user3079266
the story was really stupid. They rejected me at first (all univs except CMU, which waitlisted me, and UMD, which sort of lost my papers, did). But it so happened that I was in touch with their admissions counsellor, she emailed me to get a couple of points on the application straight. So then my dad panicked, and had me ask her straight why was it that I didn't get accepted. She told me to write an appeal. My dad panicked again and had me write it, send it and... I got accepted XD
user3079266
@deckard september =)
hahaha
panick-driven appeals are the best
user3079266
20:32
but my dad thinks it's not over yet. After this weird crap with the appeal, he's got it into his head that I just gotta be admitted to CMU from the waitlist, and we're still composing emails and having long discussions on that stuff and doing occult rituals to bring luck and that's gotta continue till may >< I'm so sick of this, and the chances of me getting into CMU from the waitlist are less than zero, and I've really wanted to get into GaTech... but - duh - if my dad gets smt in his head...
well, if you are accepted in GaTech it's really nice
I mean, you shouldn't worry now that you have something
and that something is good
20:51
no way
this is frustrating
i think it has something to do with the header guards
but i have triple check everyone of them
and everything is ok
user3079266
@deckard well, then first try doing a better job at explaining what's going on, mb I can help you =)
ok
the error is the same as before
already defined linker error
I have a config.h header file where I have all my global constants
this header file has a guard with #ifndef/define
and that same header file is included in a bunch of other header files as well as in the main.c
user3079266
including a header file in both .h and .c files? umm, you should have a good reason for this... this can easily lead to code duplication
i'm only including it on .h files
but, yes i fear it leads to code duplication and thus my redefinition problem
user3079266
so what's the exact scenario?
21:02
config.h is included in several .h header files
this leads to code duplication for each time it gets included in a header file that also has a .c associated to it
I assume that's because each .c gets compiled first, so in each .obj there is the same code
user3079266
...I don't get it...
explain
why am I doing that, you mean?
user3079266
oh, wait, I got it, so you end up with the same stuff in several .c files
in several .obj, yes
i mean, it's the linker the one that throws the error
user3079266
haha, I see. If you don't want to change your code's structure, just replace your contstants with "typed" defines
21:08
that's what i fear
there's no other way right?
user3079266
I may be dizzy 'cos it's late, but shouldn't extern work here too?
but that is only for declarations
no?
nah, problem persists
@DrorK. sorry, partly :}
user3079266
No, I mean that you could include it into only one .c file and use an extern declaration in the others
user3079266
but that's messy, I'd prefer a good old define
21:14
@Mints97 congrats!!!
user3079266
so, for example, you put an include guard into your .h file: if it hasn't been included yet, use normal definitions. If it has been included somewhere already, use declarations... wait, that's so screwed I'm surprised at my own devilry...
user3079266
@Kamiccolo thanks! =)
i've found a way
but it gives a really fucked up structure
you can declare the constants as extern in the .h
and define them in a .c
that way you can include the .h wherever you want
because it only has the declarations
well... at least that's what I think is happening
ok
let's call it a day
there's a lot to do tomorrow
thx a lot @Mints97 =)
goto away;
user3079266
21:37
@deckard I was going to suggest exactly the same: smt like config.h with the extern - s and a config.c with the definitions. Well, I still think #define's are better in this case! =)
user3079266
free @deckard;

« first day (330 days earlier)      last day (3526 days later) »