Anshul
*standard
Anonymous
How do I know which version I'm using
You can program in old style C++ in modern compilers as well. Your code will compile just fine. From your other posts it looked like you are using Visual Code and gcc (probably from mingw). You would then likely be using a compiler that supports atleast C++17
Anonymous
should I declare functions like this
Anonymous
So C hasn’t changed that much?
No. Except for atomic library there is not a big change in C.
Anonymous
int main(void)
Anonymous
Or int main()
Anonymous
int main(void)
In C, for declarations always use int func(void); For definitions int func(void) or int func() would both be equivalent
Anonymous
To follow the c standard int main(void)?
Anonymous
isn’t Mingw outdated?
Anonymous
For windows I think MSVC is much better
JP
/get cbook
Anshul
What's msvc? Btw what's the difference between MinGW and GCC?
Pavel
This have lots of things. Are these relevant to learn as a beginner?
No, you don't need to think much about differences in standards, you can set up your compiler to use C++17 and you are fine for now, as you will progress you will understand when to update to C++20.
Anonymous
isn’t Mingw outdated?
It is not. You have a choice between MSYS or mingw. I have been told that MSYS supports newer compiler versions faster than mingw.
Anonymous
It’s a compiler made by Microsoft for windows
Pavel
What's msvc? Btw what's the difference between MinGW and GCC?
MSVC is Microsoft compiler, it goes with Visual Studio (which is IDE), it's a default choice for Windows, but not the only choice.
Anshul
Microsoft visual C/C++
Does it need to be downloaded seperately or I have it with the visual studio
Anonymous
GCC stands for GNU compiler collection
Anonymous
It support C/C++ and many more languages
Anonymous
it’s mainly for Linux but Mingw supports windows
Anshul
Okay
Yusuf
/get cppbookguide
Anshul
Is mingw some company name?
Anonymous
The best way to learn C/C++ is via book because they cover details
Anonymous
Is mingw some company name?
No it stands for minimalist GCC for windows
Anshul
What's minimalist
Anonymous
It means small
Anonymous
Ok
/get cppbookguide
Anonymous
The best way to learn C++
Anshul
No it stands for minimalist GCC for windows
When I started programming. I learnt that there is a compiler which compiles the code. But later when I downloaded compiler and ide. I got to know there are many compilers many names. So it's quite confusing in terms of what's actually compiling my code? Whether it's mingw/gcc or some other thing
Anonymous
It’s gcc that’s compiling your code because you are using Mingw
Anonymous
https://en.m.wikipedia.org/wiki/MinGW
Anonymous
GCC comes pre installed with Linux
Anonymous
It supports many languages but mingw only supports C/C++
Anshul
What's g++
Anonymous
C++ compiler
Anonymous
G++ only compiles C++ code
Anshul
Does it come pre installed with windows
Anonymous
Nah
Anshul
Or with visual studio code
Anonymous
No
Anonymous
They have to be manually installed
Anonymous
https://en.m.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B
Anshul
Because I think I never downloaded it but today when I was learning a little about debugging, visual studio code asked me to make some json file and then it added g++ as a default to build any task
Anonymous
Yeah when you are compiling C++ code invoke it with “g++” when you are compiling C code invoke “gcc”
Anshul
So mingw have both gcc and g++ right
Anonymous
Yeah
Anonymous
I don’t use windows but on there site it says supported languages C/C++
Anshul
Alright
Pavel
When I started programming. I learnt that there is a compiler which compiles the code. But later when I downloaded compiler and ide. I got to know there are many compilers many names. So it's quite confusing in terms of what's actually compiling my code? Whether it's mingw/gcc or some other thing
Any of: gcc, clang, msvc are compilers, any of these can compile your code. If go to details, when we say "compiler", we usually mean the whole set of tools that allow to build an application, that at least include compiler and linker, but also can include other tools. You also don't need to know all the details about the tools at the beginning (there are a lot of details), just pick some not outdated tools that you feel comfortable with.
Anonymous
Android uses clang as a C/C++ compiler
Anonymous
Different systems use different compilers
Anonymous
My favorite compilers are Clang and GCC 🙂
Anshul
Okay
Anshul
Different compilers can have different times of compiling the code and running it?
Anonymous
Probably
Pavel
Different compilers can have different times of compiling the code and running it?
Different compilers can have different compilation times, some compilers can produce more optimized code (that runs faster), but all three: msvc, clang and gcc are pretty fast and produce highly optimized code, so you don't need to worry about it usually.
Anonymous
Pavel what compiler do you use?
Pavel
Pavel what compiler do you use?
I use MSVC to compile on windows, and gcc when compile on Linux (hopefully my code should also compile with clang, but I haven't tested it for a long time).
Anonymous
It should work
Anonymous
Under clang
Anonymous
It is not. You have a choice between MSYS or mingw. I have been told that MSYS supports newer compiler versions faster than mingw.
about that: i found out why they don't have gcc 11 yet. https://github.com/msys2/MINGW-packages/pull/9088 seems to be breaking some of their other packages.
Anonymous
about that: i found out why they don't have gcc 11 yet. https://github.com/msys2/MINGW-packages/pull/9088 seems to be breaking some of their other packages.
Oh ok. Thanks. 12 is almost ready now. They are in Alpha stage. So once the FQA/RQA is done, it will move into a Release Candidate stage and once there we can use it for developer builds.
Anonymous
(lldb) p getRelativePosition().topLeft (Position) $3 = (x = 0, y = 0) (lldb) p getAbsolutePosition().topLeft (Position) $4 = (x = 0, y = 0) (lldb) auto local = Position(touch.x, touch.y) - getAbsolutePosition().topLeft; auto percentage = local / getRelativePosition().topLeft; auto pos = percentage * Position(newWidth, newHeight); what do i do when percentage is +inf, +inf
Anonymous
#include<stdio.h> #include<string.h> //#define UNIT_COST 450; void main() { float unitsConsumed; char Customername[20]; int customerid; float Totalcost; printf("Enter Customer id:"); scanf_s("%d", &customerid); printf("Enter Customer Name:"); scanf_s("%s", &Customername); printf("Enter Number of units consumed"); scanf_s("%f", &unitsConsumed); Totalcost = 450 * unitsConsumed; printf("Total cost of power is %f", Totalcost); }
Anonymous
Severity Code Description Project File Line Suppression State Warning C6064 Missing integer argument to 'scanf_s' that corresponds to conversion specifier '2'. Project1 C:\Users\kk2\source\repos\Project1\Project1\Source.c 13
Anonymous
what kind of warning is this vs is throwing? on line scanf_s(%s,&customername)
Anonymous
Missing integer argument to 'scanf_s' that corresponds to conversion specifier '2'.
Anonymous