u/skruf - 39 Archived Voat Posts in v/programming
u/skruf
  • home
  • search

u/skruf

6 posts · 33 comments · 39 total

Active in: v/programming (39)

  • ‹‹‹
  • ‹‹
  • ‹
  • 1
  • ›
  • ››
  • ›››
Comment on: C++ is a pleasure to work with.

I have found Qt Creator fairly good with this issue

0 18 Mar 2019 09:16 u/skruf in v/programming
Comment on: C++ is a pleasure to work with.

I would say it really is not; if it were, we could not have free standing functions or global variables and other fun things... But yeah you can, and should, use OOP designs in C++. C is cool, too. Especially the older versions without type checking.

0 17 Mar 2019 00:24 u/skruf in v/programming
Comment on: C++ is a pleasure to work with.
void recurse()
{
    recurse();
}
0 16 Mar 2019 15:18 u/skruf in v/programming
Comment on: C++ is a pleasure to work with.
int (int arg)
{
    int x;
    if (arg > 0)
        x = arg;
    return x * x;
}
0 16 Mar 2019 15:17 u/skruf in v/programming
Comment on: C++ is a pleasure to work with.

Just don't go full retard on meta programming, I guess

0 16 Mar 2019 15:12 u/skruf in v/programming
Comment on: C++ is a pleasure to work with.

This one may be subtle, but is fairly obvious to the intermediate C++ developer.

I basically demonstrate wrong use of shared ptr:

#include <memory>
#include <iostream>
class Whatever
{
public:
    Whatever(int a) : m_a(a) {}
    std::shared_ptr<Whatever> getptr()
    {
        return std::shared_ptr<Whatever>(this);
    }
private:
    int m_a;
};
int main(int argc, char* argv[])
{
    std::shared_ptr<Whatever> instance = std::make_shared<Whatever>(123);
    std::shared_ptr<Whatever> same_but_diffrent = instance->getptr();
    std::cout << "instance: " << instance.use_count() << std::endl;
    std::cout << "diffrent: " << same_but_diffrent.use_count() << std::endl;
    return 0;
}

Outputs:

~$ ./a.out 
instance: 1
diffrent: 1
double free or corruption (out)
zsh: abort      ./a.out
0 16 Mar 2019 15:09 u/skruf in v/programming
C++ is a pleasure to work with.
2 0 comments 14 Mar 2019 23:17 u/skruf (self.programming) in v/programming
Comment on: Top or bottom? (WTF)

JS itself is very homosexual.

0 02 Feb 2019 10:41 u/skruf in v/programming
Comment on: Terry David says computer sciences is brain fucking the kids. Is he right?

Rest in peace, cia nigger.

0 27 Nov 2018 17:16 u/skruf in v/programming
Comment on: When all your senior devs leave and you're left with fucking nigger-brained idiots

no newline?

0 15 Nov 2018 16:14 u/skruf in v/programming
Comment on: Work as a C++ programmer

I just got very good feedback from one of the top coders, and it seems that things may go in my favor. I guess I am stressed because this is a line of work I've got no control over, yet... although work routines are falling in place now and I can be more relaxed.

Anyway, Thanks a lot for great answers from all of you! Each post have something nice. Will follow up on the books and web pages. I'm actually scouting for some material about theories around programming or computer science (such as algorithms and data structures).

0 01 Sep 2018 07:35 u/skruf in v/programming
Work as a C++ programmer
1 0 comments 28 Aug 2018 22:06 u/skruf (self.programming) in v/programming
Comment on: I guess he prefers Ruby

It's very easy to write 4 dimensional spaghetti code with javascript.

0 07 Jul 2018 20:10 u/skruf in v/programming
Comment on: C/C++ inc/decrement operator style

This is one of the things I think makes programming interesting, the different styles there is. The most interesting example I think of is Fox-Toolkit's style, the author has an, I may say, interesting style...

0 10 Jun 2018 10:42 u/skruf in v/programming
Comment on: C/C++ inc/decrement operator style

Even though modern compilers optimize for either of these uses, I'm sure, the idea was that when post-incrementing (i++), 'i' here will return the value and then increment it, which apparently takes more time than pre-increment (++i) where you would increment and get the new value.

0 10 Jun 2018 10:35 u/skruf in v/programming
C/C++ inc/decrement operator style
1 0 comments 09 Jun 2018 23:08 u/skruf (self.programming) in v/programming
Comment on: Forcing women into programming is a fucking mistake

I want to point out that there's also another very fundamental thing missing here.

You never want two classes that are similar (here, Girl, Guy) to act as two very separate classes. These should be derived from a base class "Person" or something... :/

0 18 May 2018 16:01 u/skruf in v/programming
Comment on: Microsoft reckons devs would like an AI Clippy to help them write code

This is ridiculous. Work on the same project, on same machine, apparently no form of versioning control... this can be disasterous. Pointless, useless features. More reasons for me to avoid Visually impaired Studio. Even this IntelliSense is garbage. Why do you want to have "most popular methods" on the top? Just keep em all sorted A-Z... I see no form for productivity increase or anything.

0 08 May 2018 17:23 u/skruf in v/programming
Clone the repo
1 0 comments 08 May 2018 08:57 u/skruf (..) in v/programming
Comment on: C++ Will No Longer Have Pointers

Good one. Jokes on me.

0 04 Apr 2018 20:59 u/skruf in v/programming
Comment on: Linus Torvalds - "That is either genius, or a seriously diseased mind."

Can confirm @7e62ce85 - however it's possible to do some really wacked shit with macros. Could be cool to experiment with, but avoid using them too much in a real project.

0 30 Mar 2018 11:55 u/skruf in v/programming
Comment on: Show Voat: I made a JSON tools website with a bunch of useful JSON utilities

A quick glance and it seems quite useful. Bookmarked. Thanks!

0 08 Feb 2018 14:05 u/skruf in v/programming
Comment on: I put this here, 'cause I know v/Programming will "approve." The James Webb Space Telescope is going to run JavaScript (PDF Warning) (No, they aren't kidding.)

Wannabe web "programmers" at it again!

0 05 Jan 2018 15:53 u/skruf in v/programming
Comment on: Do you hate JavaScript?

I feel you. Worth mentioning, the cancer of all is idiots using a fucking browser engine as a standalone frame, like discord, atom.io, and others. I observe that as web-developers without skills or a lack of motivation to learn new skills, attempting to write standalone programs. Feels like this could be related to some those politically correct people pretending to be coders scripters.

In my opinion, a prerequisite for learning any sort of code should be understanding x86 assembly, not meaning to learn using it to its full extent, but understand what a registry is and how they're used, difference of stack and heap, how your memory works, etc. This knowledge will teach why some failures occur and gives a completely different perspective on instructing a computer in any given language. This should also provide a good reason for why not to use a script language for more complex programs. I've never taken any classes in programming, so I'm not sure if this is even a thing. I'm self-learned in C++ though.

0 16 Dec 2017 04:51 u/skruf in v/programming
Comment on: C++: How do I work out the usage count of a function template?

Don't know why I did not think of this myself... well, thank you for the tip!

0 21 Nov 2017 16:35 u/skruf in v/programming
Comment on: C++: How do I work out the usage count of a function template?

facepalm I'm kinda slow on taking jokes. but yeah fair enough lol

1 21 Nov 2017 14:00 u/skruf in v/programming
Comment on: C++: How do I work out the usage count of a function template?

So you're saying this isn't really possible in C++ ?

1 21 Nov 2017 13:58 u/skruf in v/programming
C++: How do I work out the usage count of a function template?
1 1 comment 21 Nov 2017 13:48 u/skruf (self.programming) in v/programming
Comment on: Circuits: What is your best way to make a "hard drive", or a part of the system that saves state after power is off?

As already stated, EEPROM is your go-to here, however these have a somewhat low write limit; after the limit the chip cannot be written to. The other option is to interface an SD card, which is somewhat easily done with any MCU and using a simple implementation of the FAT file system.

1 16 Sep 2017 01:03 u/skruf in v/programming
Comment on: Python Plays GTA V

Facinating.

0 26 Apr 2017 09:12 u/skruf in v/programming
Comment on: Modern UI, flashy but ergonomically evil

skruf@voat-desktop:~$ man man

0 24 Nov 2016 21:13 u/skruf in v/programming
Comment on: Prime numbers.

Thanks for the tip

0 29 Oct 2016 16:54 u/skruf in v/programming
Comment on: Prime numbers.

Yeah I thought so aswell, the never ending discussion about making the most efficient code to a given problem!

1 29 Oct 2016 16:46 u/skruf in v/programming
Comment on: Prime numbers.

Apparently my approach gave me the desired results, but for not being the best maths guy, why should I do that?

0 29 Oct 2016 16:43 u/skruf in v/programming
Prime numbers.
2 6 comments 29 Oct 2016 16:29 u/skruf (self.programming) in v/programming
Comment on: What industry do you work in?

Construction and programming could be very different; but it's kinda the same, except in programming you would use abstract concepts to build whatever.

0 27 Apr 2016 07:44 u/skruf in v/programming
Comment on: Microsoft and Canonical partner to bring Ubuntu to Windows 10

Well, it was posted a few days before april 1st, so I don't know. Although, I sincerly hope it was a joke.

0 02 Apr 2016 22:57 u/skruf in v/programming
Comment on: Microsoft and Canonical partner to bring Ubuntu to Windows 10

Embrace, extend, extinguish.

7 31 Mar 2016 00:48 u/skruf in v/programming
Comment on: Got a game for you low-level programming NERDS

I've seen this game before and it seems pretty cool. Never had any time to try it, or much other games for that matter.

That being said, I believe you posted in the correct subverse, it's quite relevant.

1 29 Mar 2016 15:09 u/skruf in v/programming
  • ‹‹‹
  • ‹‹
  • ‹
  • 1
  • ›
  • ››
  • ›››

archive has 9,592 posts and 65,719 comments. source code.