Message from @Tero
Discord ID: 618114956684034089
You need admin access to install there
kek
```One of the benefits of installing to Program Files is that is exactly where the user expects it to go.
The biggest downside is that the user needs administrative privileges, which isn't always required by the program.```
Ain't nobody got time for that
i actually don't know why installing to program files requires admin
do things there have special privileges?
I know 20 year old electronics graduates that won't install an altium product if it pops up windows utc
lol
how do i avoid getting scope fucked in c++
if i have an if statement
to store a smaller or larger int
but then i want to use those variables globally
maybe extern keyword could help?
not sure, I've only done arduino C++, but that's how I usually do it
BJ's PPP has some prank questions, like it gives questions that require knowledge of scope and list sorting before it teaches you it
avoid global variables for most purposes
globals are fine as long as properly named and it has few setters (ideally, it's just set in one place, once)
having used threads a bit it's abundantly possible to make the kinds of errors people supposedly cause with globals by referencing an object or variable with multiple threads
`Although threads seem to be a small step from sequential computation, in fact, they represent a huge step. They discard the most essential and appealing properties of sequential computation: understandability, predictability, and determinism.`
(this is probably where functional fans come in and tell everyone about how having any shared state is bad)
for some reason this program returns x as 25 million times its number
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
inline void keep_window_open(){ char ch; cin>>ch; }
//for some reason, the square function returns 25 million
int square(int x)
{
x +=x;
cout << x;
}
int main()
{
int i = 0;
cout << "Enter a value.\n\n";
cin >> i;
cout << square(i);
}
seeing all these double >> around are you sure you're not bitshifting something?
i don't actually know C++ though
@Tero that's how you print in c++
And take input
In C++ the '>>' and '<<' indicator data flows with iostream
ok
why's it returning wrong results if not bitshifting then
Why use '+=' here @What Would Jack Conte Do? ?
I don't get the point of the cout in the function
Hmm, that could be something, nesting Couts in the return sequence
Why not ```return x;```?
He's already imported the cmath library, so why didn't he use the pow() function?
both good questions
so apparently the int-returning function square with no return statement results in undefined behaviour
sure do love C/C++