Lorenzo
Anonymous
Just because your question has the word/letter C or C++ in it, it does not mean that the question is related to C/C++.
ゾロ
In Cmake , will the subproject inherit the settings in main project's CmakeList.txt ?
Danya🔥
In Cmake , will the subproject inherit the settings in main project's CmakeList.txt ?
It'll have every setting you set before you did add_subdirectory(sub-project)
🥀
Can i ask for help?
AlanCcE
Hi guys, I'm having some problems with compiling a C program using the <math.h> lib and the autotools (automake specifically) When I run "./configure" everything runs ok, but when I try to run "make" this screen appears cause the math lib is not linked https://paste.pics/df32fc17f3d27e62737edee062614719 I already tried to: - ./configure CFLAGS="-lm" - program_SOURCES = -lm But both doesn't seems to work, can someone enlighten me?
Danya🔥
Anyways you should provide "-lm" to a linker, CFLAGS is probably just for a compiler
AlanCcE
Why do you use autotool but not cmake which is more common?
I just saw a bunch of videos about it and was trying to learn, never saw anything about cmake but seems pretty nice too, I'm going to search more about it
Danya🔥
I just saw a bunch of videos about it and was trying to learn, never saw anything about cmake but seems pretty nice too, I'm going to search more about it
I don't know what you've been watching but it's not even top-3 by popularity https://blog.jetbrains.com/clion/2021/07/cpp-ecosystem-in-2021/#build_system
AlanCcE
I don't know what you've been watching but it's not even top-3 by popularity https://blog.jetbrains.com/clion/2021/07/cpp-ecosystem-in-2021/#build_system
Haha some weird stuff, but anyway, thx for the help, otherwise i would be beating my head against the keyboard with autotools
Danya🔥
I just saw a bunch of videos about it and was trying to learn, never saw anything about cmake but seems pretty nice too, I'm going to search more about it
Since you speak Russian (judging by error messages in Russian) I suggest you watch one of Konstantin Vladimirov's courses on YouTube
Danya🔥
Or maybe ones by Computer Science Center either on YouTube or Stepik (they are different but all are good)
🥀
https://www.chegg.com/homework-help/questions-and-answers/write-program-read-integers-file-integers-counts-frequency-digit-mathbf-x-1-9-integer-outp-q107582859
🥀
Coding the problem
Pavel
Coding the problem
1. Please don't DM people 2. This is not the group where people will solve your tasks for you. If you want to learn how to solve it, show your code and ask specific questions about what you don't understand
Antonio
So I wanted to make a script that would transcribe an audio using Google's web speech api. Fragmenting the audio into multiple pieces and "transmitting" them via various virtual channels. So the result will be a simultaneous transcription of multiple audio fragments. Do you have any advice or can you help me on how to use as few resources as possible, given that I have the basic one as a audio card.
ゾロ
When we should use a inherit in C++ after we learn design pattern ?
Shahjid
#include <stdio.h>    int main() {  int sum=0;  for ( i = 1; i <= 100; i++) {  sum += i;  }  printf("The sum of numbers from 1 to 100 is: %d\n", sum);  return 0;  }  What does sum=0 means?
Shahjid
It means sum=0 .
Yes but i want explaination, why I have declared sum=0 in this program? It can be only sum.
1o
This is assignment operation
1o
You define an int type. After the int type is defined, it can only store integers. The name of the int type you defined is called sum, and then sum=0 means to save the number 0 to sum.
1o
You may be wondering why sum=0 is needed first, because it is necessary to ensure that when the subsequent code uses the variable, the variable has an initial value instead of an unpredictable random value.
Anonymous
-
Hi There’s a problem with my code When i try to run it it doesn’t return anything but when I put a printf inside my conditional statement "if" it works totally fine. Has anyone faced this situation before ? Any solution or idea ?
-
No one is gonna help you without your code
But no one has enough time to read a 400-line code😅
Iwan
ow. Forget what i said. I dont wanna get banned only to help here.
klimi
But no one has enough time to read a 400-line code😅
and what does that if? hopefully that if doesn't have 400 lines
-
and what does that if? hopefully that if doesn't have 400 lines
No 😂 It’s inside a function and It can go inside the function but doesn’t go inside the condition but if I put a printf inside that if everything works just fine
/
Help how can i compile TWRP
/
and so... what is that if?
do you know when should i use the restrict keyword
/
and so... what is that if?
is it only with pointers in a function or in the whole program
klimi
do you know when should i use the restrict keyword
i thought you just want to compile twrp not to write it... i am confused, you do you
Anonymous
Does anyone here have a channel to do a freelance project? ؟؟؟؟😕🖤
/
i thought you just want to compile twrp not to write it... i am confused, you do you
i need to know how to use the restrict keyword in a good way
/
no, read the rules
Do you know how to use the restrict keyword
noalcoholatwork
Yes, I am familiar with the restrict keyword in C and C++. The restrict keyword is used in C to indicate that a pointer is the only way to access the memory it points to. This allows the compiler to make certain optimization assumptions that can result in faster code. Here's an example of using the restrict keyword in C:
noalcoholatwork
void add_arrays(int * restrict a, int * restrict b, int * restrict c, int n) { for (int i = 0; i < n; i++) { c[i] = a[i] + b[i]; } }
noalcoholatwork
the restrict keyword is applied to the pointers a, b, and c to indicate that these pointers are the only way to access the memory they point to. This allows the compiler to optimize the code more effectively by assuming that the memory pointed to by a, b, and c does not overlap.
Danya🔥
Nice, ChatGPT
noalcoholatwork
Nice, ChatGPT
Thank you! I'm glad to have been of help. If you have any more questions, feel free to ask.
/
like add_arrays(a, b, c) and a b c are pointers
noalcoholatwork
If you pass a pointer to a function that is obtained from another function, the restrict keyword is not applicable. The restrict keyword only applies to pointers within the scope of a single function, and it specifies that the pointer is the only means of accessing the memory it points to. If the pointer is obtained from another function, it could have been modified elsewhere, and the restrict keyword cannot ensure that the pointer is the only means of accessing the memory.
noalcoholatwork
but if i pass the pointer using & is it valid
Passing a pointer to a function using the address-of operator & is valid, and the restrict keyword can still be used to specify that the pointer is the only means of accessing the memory it points to. // Perform operations on the data using the pointer } int main() { int data[] = {1, 2, 3, 4, 5}; size_t size = sizeof(data) / sizeof(data[0]); process_data(data, size); return 0; }
/
No
yes i have seen it
noalcoholatwork
not in standard c++, but it's there
Danya🔥
yes i have seen it
It doesn't mean that there's one Show me it in the C++ standard :)
Danya🔥
not in standard c++, but it's there
Oh hi, you're a real human being
Danya🔥
So it's not in C++
Danya🔥
noalcoholatwork
So it's not in C++
be specific NOT in c++ standard, doesn't mean compilers can't implement it
noalcoholatwork
Oh hi, you're a real human being
No, I am an AI language model created by OpenAI. I was trained on a large corpus of text data, and I use that training to generate responses to questions and prompts. I do not have my own thoughts, feelings, or consciousness. I am simply a tool that can assist with generating text based on patterns I learned from the data I was trained on.
/
i tried to use chat gpt before for the restrict keyword but it didnt worked
DaySandBox
Item stackoverflow.com has been added to list domain-whitelist
klimi
try now
/
try now
if i use func(&var) and func(ptr) is it the same