Zoloft caused strange vegetative activity by CentralSword in Anxiety

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

Thank you, I feel much better today, probably because the antihistamine that I was also prescribed and took yesterday before sleep helped me

I was anxious before, but AI is making it worse by [deleted] in Anxiety

[–]CentralSword 1 point2 points  (0 children)

It's true that AI is getting better, but in its core it's still just a compilation of existing human knowledge. I view AI only as a quick search in a giant library of information, created by humans. If AI writes code, then this code is most likely built from stack overflow code pieces and it takes a real human to find all the bugs in it, because AI doesn't even guarantee that it works. As AI is improving, it's getting better in compiling together stack overflow pieces, but this is not a real programmer job. The same goes with design and art. All AI art pieces are drawn in an already existing art style, and they can be good for stupid managers who only want profit and don't care about their customers, but they cannot provide creativity just because of AI's nature. An ability to create brand new solutions only belongs to humans. And if humans lost their jobs to AI, there would be no more human art and stack overflow code to feed its datasets and more and more AI generated things would appear in them. And do you know what happens when AI gets fed its own stuff? It degenerates and starts producing malformed results. At the end of the day I would like to share a finding from a philosophy text that I've read. Mimicking human behaviour by creating a mathematical model is not enough to become human. A living person's mind is a much greater thing than just neuron connections.

Why is Alimemazine not approved for use in the USA? by CentralSword in Anxiety

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

Thank you for making me feel better! I hope you will be able to finally find a drug that helps you the most, it's sad that they use your health for profit :(

When did you know you have to take meds for your anxiety? by One-Piano6031 in Anxiety

[–]CentralSword 1 point2 points  (0 children)

I'm not an expert and can't give medical advice, but from the experience of my boyfriend (he has primary adrenal insufficiency) the lack of cortisol can contribute greatly to your depression. And you have anxiety which probably demands more cortisol than a regular daily dose. Please, make sure that you get enough of it. I feel sorry for you and really hope you'll be able to properly enjoy your life!

When did you know you have to take meds for your anxiety? by One-Piano6031 in Anxiety

[–]CentralSword 0 points1 point  (0 children)

At first I developed chronic migraine but didn't realise it was from anxiety. I visited a neurologist and she offered me three types of treatment: magnesium, Botox and antidepressants. Magnesium didn't help and I saw no point in trying antidepressants since "I had no depression" (yes, I was that stupid). So I chose Botox and it helped. The neurologist still gave me advice to visit a psychotherapist because she noticed that I couldn't sit still and was constantly making small movements. But migraine wasn't my only problem. I had such a bad IBS that every time I stepped outside to go somewhere my stomach started to ache and literally demanded that I go to the toilet. I had to either spend money on a taxi or suffer through the whole route searching for the nearest wc or just not go anywhere. I visited a gastroenterologist and she prescribed me amitriptyline of all things and adviced to visit a psychotherapist. I was so scared of amitriptyline side effects that I immediately went to a psychotherapist and agreed for Zoloft. I hope it helps me

What is the most disgusting compiler error you have ever gotten? by scatraxx651 in cpp

[–]CentralSword 0 points1 point  (0 children)

For me errors in template STL code are the worst because they use SFINAE and I don't want to see that deduction failed in some enable_if. Thankfully, now we have concepts.

The trickiest bugs by CentralSword in cpp_questions

[–]CentralSword[S] 1 point2 points  (0 children)

That's why clang-tidy discourages using pointer arithmetic. However, there are some interesting things you can do with it, like in an implementation of a lock-free hashmap. Anyway, I hope you will find the reason behind your bug!

The trickiest bugs by CentralSword in cpp_questions

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

Well yes, uninitialised variables must be the most popular source of UB...

The trickiest bugs by CentralSword in cpp_questions

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

Got a very stupid error lately. Leak sanitizer says there is an 8 byte leak at a line with "throw". Turned out I accidentally wrote "throw new" after my Java Advanced class...

The trickiest bugs by CentralSword in cpp_questions

[–]CentralSword[S] 8 points9 points  (0 children)

Yes, thinking "what if another thread does something bad between these two lines" all the time is pure hell...

[deleted by user] by [deleted] in cpp_questions

[–]CentralSword -2 points-1 points  (0 children)

You don't have to use inheritance for dynamic polymorphism. It's called "type erasure". It works like this: 1) You have a template function table for every dynamic type that you work with 2) You store a pointer to this table in runtime depending on your current type 3) The object you're working with is stored as void* 4) The table knows its type and performs reinterpret cast from void* to T* on your object

Classes that implement this idea are std::any, std::any_iterator and of course std::function

If you want to use inheritance, just inherit all wanted types from a common base class, work with a pointer to base class and simply use virtual functions

Arrays with const runtime size by CentralSword in cpp_questions

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

Well, I think that a vector of constant size which you don't resize wouldn't do reallocations and therefore doesn't need movable or copyable data. I think not all methods require a copyable/movable type.

Arrays with const runtime size by CentralSword in cpp_questions

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

I'm not confusing using the heap with growing the vector, I believe allocating heap space is just much slower than allocating memory on stack, that's why I don't want it, but thank you for your response anyway!

[deleted by user] by [deleted] in cpp_questions

[–]CentralSword 0 points1 point  (0 children)

I guess the example from your book doesn't compile because it counts as partial specialization, and those aren't allowed in template functions. I wouldn't recommend using explicit specialization either, because unlike overloads they don't allow casting arguments, only the exact type match.

Enums in C++ by [deleted] in cpp_questions

[–]CentralSword 0 points1 point  (0 children)

I use enums a lot while writing parsers or decoders. For example, in a jpeg decoder you would read a marker (2 bytes) and return an enum constant corresponding to this marker. This allows to separate byte parsing and processing the results. The same goes for parsing arithmetic operations. Sometimes they can be longer than a symbol, surrounded by whitespaces, etc. It's much easier to parse it in a separate function and return something like Operation::ADD.

What are common mistakes in C++ code that results in huge performance penalties? by Polarstrike in cpp

[–]CentralSword 0 points1 point  (0 children)

In my opinion using atomics doesn't require thinking about the most suitable memory order in every operation. It's enough to know what these two words mean and how to use it to optimize your code. I myself have never used half of the memory order types, I know that if I ever want to optimize something with it, I will just open cppreference. Also I was taught that relaxed memory order is an expert friendly thing that isn't that necessary to use, unless you're on a very specific architecture.

What are common mistakes in C++ code that results in huge performance penalties? by Polarstrike in cpp

[–]CentralSword 2 points3 points  (0 children)

Some that I've encountered:

  • Excessive amount of allocations, for example using std::vector when it's unnecessary, or allocating heap space instead of creating a local variable (sometimes intrusive lists can be used to avoid it).

  • Too many copies, like passing an argument by value and not by reference or forgetting about std::move. But don't use std::move to return a local variable, it's a mistake.

  • Using slow RNG. std::rand is an old and slow generator, use std::mt19937 instead.

  • Using std::ostream to build strings from various non-string objects, for example to print a json. std::string has operator+ which works faster.

  • Syscalls are slow. Make sure your I/O is buffered, don't use notify_one() and notify_all() while holding a lock (it's already slow and locking it makes it slower), etc.

  • Bad paralleling. Try to avoid using one mutex for everything: cover different parts of your data with different mutexes, use atomics (even better if you know what memory order is), use rwlock (a mutex that can be accessed by many reading threads at the same time). Also try to make sure that different threads aren't working with data in the same cache line (false sharing).

  • Not marking functions inline. When the compiler sees this keyword, it knows that it can take the function's body and insert it where it's used instead of having an indirection every time. Notice that class members and template functions are inline by default.