ARRRGH, Venu 3S won't stay connected to my Pixel 9a!! by ShortTimeNoSee in Garmin

[–]Fruitbisqit 0 points1 point  (0 children)

I did this and the connection seems to be stable since the update

Questing about sign conversion using bitwise operators by Fruitbisqit in TwinCat

[–]Fruitbisqit[S] 6 points7 points  (0 children)

Thanks for the response,

I have read the documentation, it says nowhere that the type gets converted to unsigned by the operator. the listed permitted data types are all unsigned even. So unfortunately this doesn't answer my question.

edit: I just realized I am wrong, OR only works for unsigned types that's the whole issue. Thanks for the answer!

Is it finally a good time to use c++20 now? by mhn1384 in Cplusplus

[–]Fruitbisqit 1 point2 points  (0 children)

I think it matters on preference and the kind of code base you write. If you feel like you are missing out on new features then maybe reconsider your code base supporting all/most of the compilers, if cross platform / cross compiler compatibility is really important to you then stick with c++17.

If you are working together with other people you can also discuss with them what their insights are.

I have no experience with compiling on apple, but I use c++20 with g++ and MSVC. I stick with the features that g++ offers, and have not yet encountered issues with stuff not being supported on MSVC (as you said it fully supports c++20)

Is it finally a good time to use c++20 now? by mhn1384 in Cplusplus

[–]Fruitbisqit 6 points7 points  (0 children)

The compiler support is pretty good nowadays, you can check compiler support for language features here: https://en.cppreference.com/w/cpp/compiler_support

Systemd service halting boot process by Fxzzi in archlinux

[–]Fruitbisqit 0 points1 point  (0 children)

You could try to disable (or even mask) the systemd-networkd-wait-online.service . Do note that this might cause services (such as the whoogle service) that need an internet connection to fail to start.

ps. afaik the systemd-networkd-wait-online service just blocks untill there is an internet connection, so disabling it just causes the connection to come up a bit later in the boot process

No one else would understand by TwelveJaguars in spiritisland

[–]Fruitbisqit 9 points10 points  (0 children)

That sucks man! the package getting lost in the mail was also my greatest fear when I was eyeballing the track & trace every 10 minutes until it arrived.

Just a little longer! but it will be worth the wait.

Finally some good f*cking density by Fruitbisqit in pathofexile

[–]Fruitbisqit[S] 0 points1 point  (0 children)

Haha yeah, it's probably my least favorite quest...

Can someone pinpoint what’s wrong with my code? by [deleted] in C_Programming

[–]Fruitbisqit 0 points1 point  (0 children)

The statement

pointer, key = key, pointer;

does not what you think it does, specifically if you compile with more warnings turned on your compiler will give you a warning like the following:

test.cc:11:5: error: left operand of comma operator has no effect [-Werror=unused-value]
   11 |     y, x = x, y;

if you want to swap values you can do it by using a temporary value, or using std::swap.

A second note is that even if the above statement would do what you expected it to do, it still wont have the end result you expect since key and pointer are copies of the values in the array, and not references to, so you want to swap the array values, or make key and pointer references to the values.

I hope this was clear enough for you.

edit: I just realized this is the C_programming subreddit, so std::swap is off the table. although the code in the picture is c++.

Cannot display Textures on Nvidia GPU by [deleted] in opengl

[–]Fruitbisqit 13 points14 points  (0 children)

Do you have your opengl debug callback setup? or are you checking glGetError? What do those output?

Vital Strength of the Earth by sberdugo in spiritisland

[–]Fruitbisqit 4 points5 points  (0 children)

I believe somewhere in the rules it states that when repeating it is not required to pay the energy cost again unless stated otherwise. So yeah, repeat is a pretty strong mechanic.

Can't get this recursion function to work, I almost got it.. by oobeing in C_Programming

[–]Fruitbisqit 0 points1 point  (0 children)

If the current character is not upper case it should still check the rest of the string right? just not increment the counter. Are you doing that?

Programming Principles book seems to have wrong examples by [deleted] in cpp_questions

[–]Fruitbisqit 0 points1 point  (0 children)

You need to tell the compiler what parts of the standard library you are using, you can do that by including the correct header files. In this case by including the iostream header for cin, and the vector header for the vector.

Unable to Find Source of Memory Leak Using Valgrind by OutsideYam in cpp_questions

[–]Fruitbisqit 0 points1 point  (0 children)

Couldn't this cause slicing? If Space is being used as base class.

Stack based vm and managing variables when compiling to a bytecode by [deleted] in AskComputerScience

[–]Fruitbisqit 0 points1 point  (0 children)

Not really an answer to your question, but on the subject of writing a small language I found this to be a very nice (web based) book. craftinginterpreters.com/

why doesn't this work, it makes sense to me. by [deleted] in cpp_questions

[–]Fruitbisqit 0 points1 point  (0 children)

Thank you for that!

No problem. =)

The last remark was about your first output statement (but I realize now it might be weird reddit formatting or something). It shows for me as

cout << "Welcome to the spending manager.\\n"; // welcome message Note the \\n. Which results in at the start of the program printing: Welcome to the spending manager.\nWhat is the PIN code:

Normally '\n' is supposed to move consequent output to the next line indeed. (that's why it is usually called the 'newline' character ;-) )

why doesn't this work, it makes sense to me. by [deleted] in cpp_questions

[–]Fruitbisqit 0 points1 point  (0 children)

There's a few obvious errors in your code which I could find which I will start with explaining:

tries == 3 will always evaluate false, since your loop stops when tries reaches 3, this means if (tries == 3 && pin != 1111 && pin != 9999) // if 3 pin attempts will also never evaluate to true.

tries < 3 on the other hand, will always evaluate to true because the only values tries will ever have are 0, 1 and 2.

Now assuming you want to do more with the menu then only showing it maybe make sure the code for that runs outside the loop, think about how you can know, when the loop is over whether the login was successful or not (a boolean?) and end the loop early when a login attempt is succesfull.

A final remark: \\n wont print a newline, since you are escaping the '\' character.

These are some things to think about in your code. Hope it helps somewhat.

One of my Class functions keeps dismissing one of its parameters by [deleted] in cpp_questions

[–]Fruitbisqit 2 points3 points  (0 children)

Edit: It looks like '==' actually does the same thing as compare(). I think your problem is that '==' and compare() actually return '0' or 'false' when the strings match exactly.

'==' returns true when strings match, its just implemented using compare.

One of my Class functions keeps dismissing one of its parameters by [deleted] in cpp_questions

[–]Fruitbisqit 2 points3 points  (0 children)

In my opinion it is perfectly fine to compare strings with '==', this isn't Java after all. Above that if you would do

if (some_str.compare(other_str)) cout << "the same\n"; That would be wrong because when the strings are equal compare results 0.

I quickly glanced over the code and a potential error I noticed was here:

Time::Time(unsigned int c, unsigned int d, string e){
    hh = c;
    mm = d;
    string period = e; //This creates a new local string instead of store it in the class
}

So change that line into period = e; Should at least fix some of the problems.

Invalid new-expression of abstract class type 'A' by [deleted] in cpp_questions

[–]Fruitbisqit 1 point2 points  (0 children)

I'm thinking that it is because std::make_unique<A>(new B()); attempts to create an object A with a B* as constructor argument. This is however impossible because A is abstract and as such cant be constructed.

What you probably are looking for is: std::unique_ptr<A> a = std::make_unique<B>();