/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Attached: Drunk_Kobayashi_Python.png (640x362, 220K)

for me, it's zig

Attached: move zig.png (4824x1527, 119K)

>tfw no koba-chan gf to teach Nim to

I'm supposed to make an sql thing where I do some shit with the tables but I just remembered that I fucking hate programming.

Trying to understand a very obtuse programming language
template
auto operator=(U&& rhs) noexcept
-> typename enable_if
<
is_same::value,
optional&
>::type
{
ref = rhs.ref;
return *this;
}

writing shit on a nfc tag

just getting into Python to automate some stuff I have to do at work, but damn is that annoying. wanna do A, first you have to download module X, oh you can't install module X, because you need module Y and Z first.. damn.. just give me a complete package, with all the current modules/ libaries in there and let me code!

just code in pajeet language if you're that fucking lazy

Thanks for posting anime pic OP
All Kpop fags must die

Pip should pull all dependencies when you tried to download X.

some kind of fucked up move constructor?

What was kobayashi trying to do here?

Attached: tohru's magic code!.jpg (844x1200, 199K)

#include
#include
#include

using namespace std;

bool CheckWord(char * filename, char * search) {

int offset;
string line;
ifstream Myfile;
Myfile.open(filename);

if (Myfile.is_open()) {
while (!Myfile.eof()) {
getline(Myfile, line);
if ((offset = line.find(search, 0)) != string::npos) {
cout

Attached: IMAG0131.jpg (1668x932, 215K)

looks like webshit.

webpage using external google source js libs.
Manga Autor maybe just copy random code from google images.

This isn't an issue if you know C++ (not retarded).

Native platform programmers are cringe

Attached: IMG_20181022_085119.jpg (1125x1732, 194K)

orly. What does that code do then?

i want to nakadashi kobayashi

>degree computer science
>I am true developer
State of computer science

It's implementing copy-assignment for any std::optional type holding a reference.
Can't tell whether it's just copying by value or by reference because it's unknown whether ref is a reference or a pointer.

>any std::optional type holding a reference.
to the same inner type*

>tfw never used build tools so far
I have a bunch of source files in a folder, each their own standalone task, is there an effective way to build them all with one command and name the executables the same as the source files?

I asked a few days ago regarding data science + python+R stuff. A cool dude linked www.datasciencecourse.org/lectures/
Now I understand math is extremely important however I am unsure how to express the math in python (or R). Is this what's actually meant to be learned in CS ?

ha.... that actually makes sense. Thanks for the explanation.

make is the only decent build system.

just write a makefile
it's easier to think of it as a specialized script that defines your end result and the various steps required to create your end result which can be anything from a single executable to a large software project.

>tfw pythonlet but want to learn C++
>see this shit
Jesus, how do you guys do it?

let me know when make can fetch packages, compile them, and update them as needed all while building the application that uses them.

auto operator=(const std::optional &rhs) noexcept
{
ref = rhs.ref;
return *this;
}

Should be equivalent.
I don't think the SFINAE is needed.

Never, thank god.

>Never, thank god.
>i enjoy using subpar tools
should I get you some sandpaper to wipe your ass with too?

Hey guys, C++ newbie here. Why would you use a forward declaration for a function before the main?

The only one who uses subpar tools is the one who thinks his build system should be a package manager.

tell me why a build system shouldn't also be a package manager.
Hard mode: No blanket "bloat" shitposting, give an actual logical reason.

compiled languages dont really have whitespace restrictions so people like that will write really poor code and then post it online to confuse other people
i went from python to C & C++ perfectly fine because the people who taught it wrote readable code

You're never actually supposed to forward declare functions or variables in source files manually.
You put them in header files and they get copy pasted into the source file during pre-processing

if you don't want to forward declare main, it makes sense to include it as the final function in whatever source file it's in.

Did you learn C++ in a class, or did you use some online resources?

Separation of concerns.
It's a BUILD system. It should only be responsible for building the code.

packages are apart of the system, therefor they are needed for the system to build properly.
oh boy what a terribly difficult concept.

The build system only cares whether the dependencies are present or not, and if they are then figure out a dependency graph and build the code. Dependency presence is a direct concern of the build system, fetching them isn't.
Fetching the dependencies is the job of the package manager. A build system should just fail if dependencies aren't present.

JavaScript rocks!

Attached: js-rocks.png (1000x494, 369K)

I really really like this image.

So you arbitrarily want to separate them because?
You're admitting you want a dumb build system who will fail at any slight thing. Then admitting you want to do the job of a package manager yourself because reasons?
So what kind of nails do you sleep on?
When's the next bleach shower?

I'm learning python with thonny [spoiler] for fun [/spoiler] is it a bad idea if I'm just trying to understand basics?

So you arbitrarily want your build system to download packages because?
>do the job of a package manager yourself
My package manager does the job of the package manager. Not me.

>So you arbitrarily want your build system to download packages because?
There's nothing arbitrary, i specify a package
it downloads the package.
I'm still not hearing a logical reason to split the systems other than some irrational uncle bob-tier bullshit. Or do you just really enjoy wasting time writing make files?

I mean you're right but I think it's pretty damn gay to be sitting on twitter talking down to people about not being 1337 while you cry about segfaults

nothing of value has ever been communicated over twitter, ever

A bit of both honestly. I had AP CS in high school and they taught us Java but I don't really remember that much about it because I don't have much use for it.

I had a year of not programming and then i decided to go for a CS degree instead of engineering and my CS 2 class taught C++ and the professor who taught it had pretty boring lectures but we had to normal homework, small programs and medium sized projects and the latter 2 that we did really drilled it into my brain I think.

Although he had a site where he had a bunch of guidelines and explanations about poor programming practices and what to do properly, I mainly just learned from the book he had on his website (Big C++, Horstmann & Budd, John Wiley & Sons, 2nd Edition), but honestly you can probably just use any good book.

I also learned C after that, and it made a lot of sense going from C++, for which I read "A Book on C: Programming in C" by Al Kelley and Ira Pohl. I also read the ANSI C Programming Language but that's harder to read for beginners and is more of a reference for intermediate programmers, so you shouldn't beat yourself up if some of the stuff doesn't make sense immediately

There's nothing arbitrary about wanting ls to be a C compiler, i specify a file
it compiles the file.
I'm still not hearing a logical reason to split the systems other than some irrational uncle bob-tier bullshit. Or do you just really enjoy wasting time remembering two different commands?

I'm I think the big thing comes down to what ide you find best. I'm currently using Spyder.

Mega dumb question. Is it possible to have a "template C file structure" on VsCode? For example, I am tired of always typing this on every file that I work on. I would just like to open up a file with these lines already typed in. Hopefully my request made sense. Thanks in advance.
#include
#include
#include
#include

int main(int argc, char** argv)
{
return 0;
}

convenience, saves time, consolidates everything i need in one folder for me. I don't have to waste time writing files from the 80s out of some delusional notion of being "just like the good programmers who don't need no fancy modern tools" to build and compile my project.
But it's clear you have absolutely no arguments if you're just going to keep shitposting my posts at me. Typical dumb cniles are nothing but baby ducks.

why would you have a main in every file you create

Agreed.
Dumb cniles will never understand the convenience of my all-in-one ls and C compiler.

>shitposting my posts at me
Shitpost goes in, shitpost comes out. Simple.

Hello, I'm here to let you know make can do all that out of the box.

I see your point, I guess it wouldn't be helpful at the times where I am just writing a single function to group into another file. However, is it still possible to at least choose the times where I want to use said "template".

arguments shouldn't be pure in this case.
yes after you explicitly tell it to. writing the script yourself kind of defeats the point.

i really really hope you're not shelling out and calling non-standard unix commands from your makefiles

I would just like to open up a file with these lines already typed in

just use an IDE or make some script in emacs/vim that does that for you

>Writing scripts? That's too hard!
>I can't figure out how to use my distro's package manager so just fucking download it for me so I can get back to programming my dildo in Javascript. How else am I supposed to check if a number is even? That's what libraries are for!

So far I dont know wether I want a different ide or not really, I just want to get a general idea of how things work and I got encouraged to pick up Python. I'm not doing this for school or work though, just learning/fun.

let me guess, you're on gentoo and ONLY download source code right?
You've DEFINITELY never had apt or pacman or etc fetch and compile something for you? Because that'd be heresy and the programming patrol are going to come kick down your door for breaking ACRONYM.

>just use an IDE or make some script in emacs/vim that does that for you
Sounds fun, going to look for some tutorials on how to do it. Thanks user.

Gentoo is shit. Stop complimenting it by implying that only smart and reasonable people use it.

If you're trying to learn I would go the text editor script automation way but if not then just use an IDE

you're wrong but ok

Typical NPC response.

You can probably create a snippet for that

Yeah, going to fuck around with the automation idea, and I see as that there's an option to make a "snippet" on VsCode, as the user already mentioned. Either way, I see that it's possible, thanks for your replies.

i dont know what that means but Gentoo is fun to use if you're not a recluse that can handle stepping away from your computer for an hour

>doesn't have a simple code templates

Attached: code_templates.png (637x302, 16K)

I use CLion cause I have a student discount that lets me use their products for free and it does it for me. I imagine probably sublime and notepad++ and VSCode and do it as well if you spend like 10 minutes of researching how to

>Code templates
Jesus christ

i don't have the autism to write every trivial stuff
fucking dinosaurs

what is wrong with that?

nothing if you dont want to waste your time re-writing the same lines of code over and over again

Fuck me, did I really spend an hour on learncpp before I even got to variables

holy FUCK you're bad at programming computers :D

HECK!!!!!!!!!!!!!! :-DDD

I don't know why I read it all. I really should've just skipped it.

I'm a recluse can I just sit at the computer and wait or what

He's probably just trying to look hardcore for the gril

>I wish this ground was harder

You should not drink and code

Attached: 0B1467AD-8AE6-43F7-A29D-0C9274358ED1.jpg (1920x1080, 109K)

You must only write trivial programs if making a fucking template for or makes any difference at all to your productivity.

obviously you don't know shit about coding front end shit. i wonder if you even have that productivity tracker running while writing repetitive shit codes for muh outputs lmao.

>At least I saved 2 seconds and a couple dozen key strokes with this code template.
>Now to spend months and billions of keystrokes writing up the rest of the program.
Oh wait you only write small trivial programs. Never mind.

Ballmer peak tho

>Oh wait you only write small trivial programs. Never mind.
muh comprehension and moving goal posts

Attached: dumbass.png (602x103, 8K)

Why is C still so comfy?

Attached: 1493178459223.png (2015x2204, 704K)

It's not, really.

No goalposts where moved. You only write small trivial programs. That was my point from the start and it's still my point.

it's not

>Anons talk about how templates save time
>Templates don't matter because you write small programs
Why are you arguing this when no one mentioned writing large & complex programs?

sure faggot

posted some related image, because that fucking idiot is a dumbass who doesn't even have a large project to begin with. even a simple template helps let alone code completion.

Attached: trivial_sure.png (969x299, 42K)

Because my point is they're fucking useless, stupid, and you shouldn't bother with them.

>i wonder if you even have that productivity tracker running while writing repetitive shit codes for muh outputs lmao.
pajeet hacks 101

Wow nice project, isn't it great how you saved all those 5 WHOLE seconds and not having to type an ENTIRE 8 or so lines at the beginning of your project.
So productive.

i saved a lot tho, keep seething faggot. also it's a built in feature, why not utilize it.