Roxifλsz 🇱🇹
Ask the actual question you have
Roxifλsz 🇱🇹
Roxifλsz 🇱🇹
Sure
Anonymous
Send your code via pastebin.com, not files
András
Send your code via pastebin.com, not files
Why nobody offers ideone.com?
Anonymous
Why nobody offers ideone.com?
Yep, that's also legit But I personally like more paste.ubuntu.com, but it's more to type😂
Eldor
hi guys. Could you help me. the compiler doesnt show where eroor is but when i am rebuilding it finishis with error
Eldor
it shows only warning but in the end finishs with error
Eldor
why Accsees can be denied because of what ?
Eldor
Eldor
Anonymous
There's no error
Anonymous
it shows only warning but in the end finishs with error
close all instances of the program before trying to run again
Eldor
this is an error while i am building the project.
Eldor
There's no error
there is no error in sintakse
Anonymous
didnt helped.
Check in your taskbar, there is likely a command prompt window open from when you were testing earlier, if there is close them
Anonymous
How to setup clion for socket programming ? Please if anyone know pm me
Anonymous
I already searched it not working bud
ArrowInAKnee
Hey everybody! I've encountered a problem with c++. I've made myself a template class that enables me to automatically put my initialization functions into a global array and call them at certain point in lua. The thing worked just fine, but i decided to move the array initialization to a separate file. Everything compiles fine, but when the time to call the functions comes the array is being empty. Moving the initialization back to the file with main fixes it somehow (but sometimes not, and considering the fact that this is the only thing i change)
ArrowInAKnee
this is the file with array declaration (stack is defined in ttl.h)
ArrowInAKnee
And this is the initialization that behaves differently in different files
ArrowInAKnee
Does anybody have an idea? I've been trying to fix that for 3 hours by this moment
Pavel
I had similar problems when tried to use some static initialization tricks from Alexandresku book, and that failed in similar situations
ArrowInAKnee
It is filled by different object constructors. It's initialization allocates memory for it and sets it's capacity and amount of elements
Dima
oh, you are finally awake
Pavel
Because if they are, then it sounds like static initialization fiasco http://www.cs.technion.ac.il/users/yechiel/c++-faq/static-init-order.html
ArrowInAKnee
That's how i do it
ArrowInAKnee
ArrowInAKnee
Pavel
So, my initializers may be pushed before the array constructor is called?
Yes, the order is not specified, so it can end up in any order. You moved the initialization to another file and it changed the order. Another compiler or version of compiler, path in the file system, or moon phase can change it theoretically
ArrowInAKnee
yeah, this was the actual problem. Interesting but not quite fun stuff 😅
ArrowInAKnee
Thanks a lot! I'll now try to fix it in a way that is proposed in the article. I had similar thoughts on how to do it, but this way seems much cleaner
ArrowInAKnee
It's rather interesting how the problem appeared only after a rather long period, cause i've already moved the things around a couple times
Anonymous
typedef enum{INTEGAR,STRING}StringorInt;
Anonymous
StringorInt Initial_Questions(){ StartOverMyG : clearScreen(); char stringOrIntegarArrayChoice; puts("Do you want to create a String or an Integer Array?"); puts("Type I for an Integer Array or S for string Array"); scanf("%c", &stringOrIntegarArrayChoice); switch(stringOrIntegarArrayChoice){ case 'I': return INTEGAR; break; case 'S': return STRING; break; default: goto StartOverMyG; } }
Anonymous
if i have enum and a function that is of that enum type, and returns values from that enum, can i store it like this StringorInt choice = Initial_Questionst()
Anonymous
i am trying to store what this function stores in a variable like so
Dima
lol goto in 2019
Anonymous
1) this code style is unreadable 2) using goto and labels makes it unreadable af
the function takes a user input, either I , or S, this is stored in a variable and passed in a switch statement
Anonymous
Learn loops
Anonymous
if its I , it returns an enum INTEGER, and if its S it return STRING
Anonymous
Learn loops
typedef enum{INTEGAR,STRING}StringorInt;
Anonymous
my question is more to do with storing enum values in an variable
Anonymous
Learn loops
i know how to use a loop
Anonymous
Learn loops
my question is how do i store what that function returns in a variable
Anonymous
it returns enum symbols
Anonymous
What's wrong with MyEnum var = f(); ?
Dima
Sir Stringor
Anonymous
What's wrong with MyEnum var = f(); ?
functions.c:43:7: error: variable 'choice' has initializer but incomplete type 43 | enum StringorInt choice = StringorInt(); | ^~~~~~~~~~~ functions.c:43:19: error: storage size of 'choice' isn't known 43 | enum StringorInt choice = StringorInt(); | ^~~~~~
Dima
Anonymous
Don't use enum You have typedef already
functions.c:43:13: error: expected ';' before 'choice' 43 | StringorInt choice = StringorInt(); | ^~~~~~~ | ;
Dima
Anonymous
they let you out from under the bridge today?
Anonymous
they let you out from under the bridge today?
Lol You have one warn already Don't be so dangerous One warn — and you banned
Anonymous
Just use int to store enum values
Anonymous
C++ has more convenient way to store enums
Anonymous
can't reproduce https://godbolt.org/z/fBPXma
i just posted part of it, its not the full thing
olli
i just posted part of it, its not the full thing
I thought so, but with the given information we cannot reproduce the issue and hence not answer your question.
Anonymous
I thought so, but with the given information we cannot reproduce the issue and hence not answer your question.
question is it possible to pass a function pointer to a function , but that function pointer points to a function that also takes a function pointer as a parameter
Anonymous
void create_Array( ArrayData(*CAMAPPointer)( StringorInt(*IQPOINTER)(void) ) );
Anonymous
idk if this is the proper syntax, but i have a create array function which takes a function that the CAMAPPointer points to
Anonymous
that function it points to also takes a function pointer as a parameter, which i put as IQPOINTER
Anonymous
Is this the same as argv
i trying to make pass a function as an argument to a function