/dpt/ - Daily Programming Thread

old thread: How many lines of code do you need to draw a triangle Sup Forums?

Other urls found in this thread:

i.4cdn.org/g/1506133720060.webm
pastebin.com/6vM2PEN8
dlang.org/spec/function.html#inout-functions
langserver.org/
twitter.com/AnonBabble

Rust/Idris/Agda

java is better than sepples

Is there any point of learning python2 if I'm learing python3?

incorrect. java doesn't have value types

probably better to learn python4 at this point user

I normally come around these parts but i'm in dire straits trying to figure out why this line isn't doing its job. Any ideas?

there's like literally two syntactical differences

What's the point of COBOL?

Just () for functions and what was the other?

same as if (temp != null), retarded way to write it, change it.

>an entire schism in the python community, resulting in two incompatible language versions that will never be reconciled
>all over two syntactical differences
this can't be true

Because you're setting temp the line right before it.

does it do anything when its false?
also use !=

I think i'm seeing my issue now, what's happening is not that the array is having a null value put in (which is what i don't want to happen), the line is doing its job, its that the array is too long in the first place since the file has a blank line at the end of it. Any ideas how to deal with that?

Reminder that if a language does not allow you to abstract over higher-kinded types, then it is not practical.

If you dont know how long your array is going to be to begin with, use an arraylist

now that the dust has settled, how many people has C killed, Sup Forums?

which areas of programming should I practice that will be useful for getting a software development job?

>which part of carpentry should I focus on thay would be useful for getting a carpentry job

logic

Can you implement a vector of primitive types yet?

*In C++

Now, this is how you ask a question, it's not broad or anything.

>How many lines of code do you need to draw a triangle Sup Forums?
one.

how many people has Java killed?

how many souls has Java destroyed? How many minds, wasted?

Java is responsible for at least 2,000 suicides a year.

This is your programming challenge

Java will turn india into a superpower by 2020

>>How many lines of code do you need to draw a triangle Sup Forums?

on what?

Rate my solution to this.
#!/bin/sh
curl i.4cdn.org/g/1506133720060.webm | mpv --vo=caca -

>How many lines of code do you need to draw a triangle Sup Forums?
195, apparently. (Or at least that's the way it was 13 years ago, when I was 14).
pastebin.com/6vM2PEN8
Does Sup Forums still have any of its beginner projects?

>it still compiles

20/10

Hey Sup Forums, which do you use
i = i + 1

or
i++

So good it might as well be cheating.

In D, there is a specifier called inout. It overloads the function over constness.

For example, if you specify inout, you can pass a constant or a variable. Is there anything similar in C++?

++i

They are not the same things.
i += 1 is similar to ++i; i++ means return(++i);

They are not exactly equivalent.

Hey, if I want to access static functions through Example.Child.Child.Function should I use namespaces or nested classes (C#)

actually, they are.

I dislike this. The redundance between the expression value and the value stored in i is pointless.
i++ covers more cases.
Where you meant ++i and use the expression value conflating the two is pointless and a rare case.

Consider having and output parameter and return value be the same thing.
True. user should have added ; to the end to make them complete statements and equivalent. Maybe even start with ; for extra clarity. I think you should assume these are intended as complete statements though.

Just use i = i + 1 if you need increments because not all languages treat ++i or i++ the same

>actually, they are.
int i = 3;
int j = 3;
printf("%d %d", j = j + 1, i++);

Are you shitposting?

Wtf lads, you guys told me java was a poo language, but I've been finding it pretty good so far. Care to explain?

>Care to explain?
You haven't been exposed to a language that isn't garbage yet.

you have bad taste user

java is great
/dpt/ is autistic

scala > java

That's because you don't know Haskell.

>praising haskell
That's because you don't know Agda.

Mostly yeah.
I do read ++i as special intent compared to i++ though. Just as I'd take a little longer to parse i=i+1 in a language with ++.

3

maybe 4

What language is Agda written in?

You have to go take a shower. Then go back to smell your seat. You'll realize you've been excreting from your poores just like a real Indian.
It's just a side effect of the language. Some deal with it, some don't.
This is where the general dislike for Java programmers come from. They mistake the smell for poor hygiene. They're not too bad when you're past the smell.

you forgot 1 and 2

>Still hating java in 2017
Then explain how white british programmers made runescape into one of the reasons why java was so successful

>Java is only popular because of RuneScape

>t. it's popular, so I don't like it

>One of the reasons means only reason
So, this is the literacy capabilities of java haters

butthurt Java devs

>He has literally no arguments
pathetic

>butthurt EMPLOYED java dev
fixed for you poor Haskell cuck

they're back
and more butthurt than before

zero


△ △

What are you doing exactly?

project management

Damn. C++ should really keep up.

1. It seems as if the language can't lock generic types. Think of it as the opposite of the available template specialization. Where you specify the only allowable types instead. If you are still confused consider this scenario :if you want your generic type to be only over int8_t and and16_t and nothing else, you are boxed.

2. Cant generalize over constness. You can use Overrides to emulate it within virtual member functions but out in the wild, you can't. Read dlang.org/spec/function.html#inout-functions if you are confused at this

3. C++ doesn't have reflection and ranges. Working with a lazychain of higher order functions is tedious. Lack of UFCS makes it worse.

4. Lack of standard modern project management system. Before you mention CMake and Meson, remember that these are not standards. Learning how to use CMake is learning a 250 page reference. CMake is painfully counter productive, and counter intuitive. Meson would be a nice attempt to accommodate the lacking of CMake and yet it doesn't have package management. With Rust, Nim, D etc, you only have to write a single line of command, with your specified set of arguments to get a standard project hierchy, and build/debug configuration, documentation (please allow me to remind you how mediocre doxygen is) set. Cmake and ninja is just not in that level of ergonomics.

5. No decent language server. The clang team is working on their Clangd however they are miles away from stability. You end up depending on non-standard linting, completion, formatting and whatnot.

Overall, C++ hasn't really had a major improvement since C++11. It needs work in both the language and it's tools. Why can't C++ get out of this "forever behind the standards" culture?

kys

Still not an argument

Downloading his video, and playing it with mpv using a silly output mode.

>Clangd
>d

all of the things
more is gooder

>if you want your generic type to be only over int8_t and and16_t and nothing else
I won't disagree that C++ is way behind the times, but why would you want to do this?

11/10

It's a language server.

does it make you mad when you run into shit programming in the real world?

While specializing templates, if two of the types are to behave the same you will have to repeat yourself.

Unless you use an inline function to cover the common procedures. But this is just a whacky workaround

see

I say we move to a new language.

Why the fuck would you ever need a language server?
What's wrong with just using gcc to compile your programs?

>template specialization

what the fuck is that even supposed to be?

langserver.org/

Also, GCC is exploring their possible implementation of language server too

Looks like the ascii raytracer user worked on a few days ago.
But I can't visualize the 3d object this represents.

>The LSP was created by Microsoft
aand you lost me.

Anyone notice how GCC hasn't actually done anything by themselves for years until clang came along and started making C and C++ languages you can work in? It really was at a complete standstill.
Makes me sad that GCC is so hostile to competition.

Language servers have language server protocols, Microsoft has their own, fully open source language server protocol.

Clang devs are paid and pushed by apple though

Why are Rust users so unintelligent?

>Le reddit man
Fuck off.

>GCC can compile the linux kernel yet clang still can't even with shitty hacks

How does something like DOOM (or its source port) actually draw?

I looked inside the source code of some old dos games, and some modern ports, and I saw render calls, but I wasn't able to make sense of where they went. With the modern ports (like chocolate doom) I thought it would be easier to search for one of the commands that has SDL blit or render something and I couldnt find anything there either.

I want to be able to make a simple engine where I can easily swap out the libraries without it affecting the overall game. It's for learning/hobby.

I know. But I still find it weird because for at least a decade GCC was the de-facto C/C++ compiler and had every company in the world relying on it.
But nobody could make tools for it because it was such a hostile environment (core reason for why people did clang, see pic. Accepting major inconvenience in the name of something other than good software tools). You'd think someone politically motivated like RMS would see how incredibly poorly it looks for GCC and open source software in general even if literally nothing happens then. Open source isn't that controversial now but back then it was.
Good insight user I'll note it down. But do remember that if you're targeting one compiler like Linux does you shouldn't be surprised when it doesn't compile elsewhere.

>Open source
You mean free software. "Open source" is probably a ploy by businesses to trick programmers into helping them build proprietary software for free.

>if you want your generic type to be only over int8_t and and16_t and nothing else, you are boxed
Make a template, and only use it with int8_t and int16_t. If you really need to be anally retentive, use a static_assert.

>Cant generalize over constness
Meh. I'll concede this.

>C++ doesn't have reflection and ranges.
IIRC, Ranges are planned for being implemented in C++20 or some shit. Reflection isn't happening because in spite of its high level features, C++ is a language designed for low level purposes.

>Lack of standard modern project management system
No single build system could ever incorporate the vast level complexity among different C++ projects. CMake comes close, because of its extreme flexibility, but it is still a clusterfuck. And yes, it is a huge standard, but if it were any less, it would not incorporate all of the flexibility that C++ programmers want. And don't say Rust's build system is great. Cargo is hot garbage and forces everything to be built their way or the highway. And the second you want to add in code from other languages, you're forced to add a build.rs, which is absolutely fucking terrible. Rust is not meant for build scripts.

>No decent language server. The clang team is working on their Clangd however they are miles away from stability. You end up depending on non-standard linting, completion, formatting and whatnot.
I have never needed any of these things. Just type crap up in text editor and build over command line. Intellisense gets in my way when typing, and it's annoying as hell.

No open source was controversial back then. Companies believed that every aspect of their software had to be completely secret and closed to everyone but trusted licensees.
Free software as RMS puts it is still controversial.