/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last threads:

Attached: 1545563847348.jpg (1280x720, 456K)

Other urls found in this thread:

onlinegdb.com/B1JIc2KXS
jsfiddle.net/XBfzn/
youtu.be/Qc6THuvpy8k
twitter.com/NSFWRedditVideo

Khm, fuck C++ and C++ coders

>What are you working on, Jow Forums?
Vulkan. Who can make this output Winner? onlinegdb.com/B1JIc2KXS

#include
#include
#include

int main()
{
int numRead = 0;
char numberStr[7] = {0};
while (numRead < 1) {
printf("Enter a float > INT_MAX or < -INT_MAX-1: ");
numRead = scanf(" %6s", &numberStr[0]);
int i = 0;
for (;i < 7; i++) {
if (numberStr[i] == 'e' || numberStr[i] == 'E') {
numberStr[i] = '.';
}
}
}
numberStr[6] = '\0';

float val = atof(numberStr);

if ((float)val < (double)(-INT_MAX-1) || (float)val > (double)INT_MAX) {
printf("Winner!\n");
} else {
printf("Sorry, you entered %d\n", (int)val);
}

return 0;
}

Alternative chall jsfiddle.net/XBfzn/ PID algo chall

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

Well im working on learning how to code ass shit

INF

Winner, nice! Or -iNf -infamy infamy infinity +INF or any combo. But not NaN

>gamedevs hate C++
>gamedevs hate all of software
Is there anything they don't hate? Is this why all they make is violent videogames? Are they actually misanthropes that are set on teaching our children to kill everyone?

Attached: Screenshot_20190808-173324_1.png (1080x1370, 178K)

hot pockets, chicken nuggets, dr. pepper

>programming causes violent video game developers
Now this is the big think

Ban assault programming socks!

Gamedevs are too lazy or brainlet to use anything else. JBlow is an example of someone who actually did something rather then just bitch to the void. Even though Jai is pretty underwhelming and more of just his personal anti-C++.

Jon Blow isn't "gamedevs". Jon Blow is a senile old man who hates everything. He also hates violent video games and only makes boring puzzle games

>too brainlet to use something other than the most complex programming language in existence

Is TDD a meme?

First for erlang

Attached: 1565060349679.jpg (1242x1212, 899K)

SITREP:
youtu.be/Qc6THuvpy8k

In the case of the AAA, it's laziness and sunk-cost. In the case of indies, it's a combo of both, less popular langs have less resources and guides to look to, as well as less knowledgeable people to help. So you're on your own a bit more, as well as implementing more yourself.

Not using TDD is a meme. Consider yourself a meme developer if you aren't using it/

>In the case of the AAA, it's laziness and sunk-cost.
No it's not it's the fact that C++ is the only language that gives you power and expressiveness
Stop talking out your ass
Indies don't use C++, they use Unity with C# or Game Maker or some shit

test DD is.
type DD is not.

Tests are not a meme.
TDD is. TDD people think its the only way people will actually write tests for their programs.

>C++ is the only language that gives you power and expressiveness
alright bjarne, don't want wanna be late for the next meeting now.

We need a friendly daily programming thread.

I hate C++, it's just the truth. You have direct memory access, you have OOP, you have zero-cost abstractions like templates. That's why it's used. No other language really meets those requirements

we had a few of those

There are a million to-C langs whos performance is on par or marginally irrelevant to C++'s while being infititely more succinct.
>templates
>zero cost

infinitely *

wonder what will come after zoomers
the world is changing faster than i thought it would

I know. I use one of them. But they aren't popular. None of them are really as powerful as C++.

>None of them are really as powerful as C++.
C++ literally does not have anything special about it. Compared to many langs, C++ is lacking, especially in the functional world. And because it's a corporate controlled language, it takes atleast half a decade to get anything moving in the way of improvement or changes.

Tell me a language I can use to replace C++ for gamedev then and I'll check it out

I'm trying to learn C and I can't figure out what I'm doing wrong here:

int d = strlen(argv[1]);
printf ("Arguments: %i\n", argc);
printf ("Length of Second Argument: %i\n", d);

if (argc != 2 && d != 1);
{
printf("Enter a single character.");
return 0;
}

It's supposed to verify that only two arguments are being passed in the command line, and that the second one only has a length of 1 character. When I run it, I get pic related.

Logically it looks sound. What am I doing wrong?

Attached: Capture.png (289x58, 2K)

Zig, Terra, Nim, D would be my shortlist.

haskell

Programmers are literally just glorified vidya neets.

I find it hilarious that you people respond to arguments criticizing the speed of functional langs or praising the speed of imperative langs with ">muh vidya" when in fact every single one of you, with no exceptions at all, also wants to make vidya and is in fact studying programming for that very purpose.

Go back to /dpt/figs

Attached: kirb.jpg (192x192, 7K)

>when John Carmack can't even rewrite Doom in Hasklel

argv[0] is the program name "./char", argv[1] is the first argument.

I want to try out flutter building a small app, should I make a virtual machine with linux obviously or use my OS? I dont want useless files and stuff after i finish, what do you guys think?

Zig is a C replacement, not a C++ replacement, doesn't have any C++ features
Nim doesn't appear to have templates
last I checked D was a clusterfuck of a language that didn't know what it wanted to be
never heard of Terra

Oh no user. Look at the end of the if statement line. Its a very classic bug.

>if (argc != 2 && d != 1);

>doesn't have any C++ features
what features do you need?
>Nim doesn't appear to have templates
macros, and it has OOP and polymorphic types
>D was a clusterfuck of a language that didn't know what it wanted to be
And c++ isn't? D's only problem is the GC, and C++ people seem to have no issue rolling their own std, so i don't see the issue.
>never heard of Terra
it's a neat lang, depends how you feel about lua though, which you use to meta-program Terra which does all the work.

Try passing the -W flag to enable warnings. Its a good idea.

kek

I'm sitting here looking at his code, what a blunder

Right, and it's making the length of argv[1] into an integer for comparison in the declaration of d. So, ./char d is:

argc = 2
argv[0] = ./char
argv[1] = d
d = 1

Is argc != 2? False
Is d != 1? False

So it should progress, right?

use code tags

include enough code so that this compiles

check that argv[1] is in-bounds before accessing it

Indeed. Its devious.

Welp. Time to go and jump off a cliff. Thanks, Jow Forumsuy!

Before you do see GCC might warn you about cliff height if you use -Wall

OOP, templates, operator overloading are the biggest ones I can think of. That aside, Zig just looks like a different flavour of C, it's not even better than it, let alone C++
I didn't see templates in the Nim documentation, it might meet the requirements but I still wonder why it's been around for over a decade and nobody has started using it yet, same with D
Terra is just some wierd shit that is not applicable here

Hah! Thanks. I'm not terribly familiar with that sort of stuff yet, but I'll ask my mentor about it.

wanna code but too tired

Attached: 1534415304335.jpg (600x419, 112K)

Talking to people like you who have used C++ for too long is pretty surreal. C++ has rotted your brain so you can only think in a few concepts, and can't translate how other langs might do something differently. So if one lang doesn't have OOP or meta-programming like C++, or use the same vocabulary, you sort of shut down and dismiss it immediately, instead of investigating further.

>eat with a fork
>someone suggests using a turd instead
>"OMG why don't you like getting shit all over your hands and tasting shit when you eat?"

just stop being tired

I don't use C++. I'm not dismissing Nim or D, I'm just wondering why nobody else use them. Zig looks like shit and Terra isn't suitable for the purpose

how

Attached: 1450718125451.png (412x560, 265K)

>implying C++ is as simple or functional as a fork
>implying anything is as complex as a turd in comparison to C++

>I'm just wondering why nobody else use them.
See, this is also a problem. /dpt/ and people in software have this notion that a lang is only usable if it's being spammed relentlessly, being jerked off by a big company, and seemingly everywhere they look. Which is why Rust is now pretty much cemented. Mozilla were smart and knew that programmers don't give a fuck about new langs. But they know from a long line of advertising, that if you bombard people enough with something ,they'll eventually accept it as normal. So they made Rust popular, by being popular, and people never questioned the origin of its popularity.
tl;dr a language doesn't have to be top 5 in github for people and companies to use it.

Stop programming. Spend at least 4 hours outside today. Eat healthy meals. Get some exercise (combining with being outside is a good idea).
You'll be slightly better tomorrow. If you keep repeating this eventually you'll feel good enough to program and then you can incorporate programming into the routine.
Then the world is your oyster basically.

Fuck this guy. Spend free time looking at gay anime girls. Programming is anti-human and we need equally deviant relaxation.

>a lang is only usable if it's being spammed relentlessly, being jerked off by a big company, and seemingly everywhere they look
But this is unironically true.
Programming is about money, therefore the people who have the money decide what languages are good, not the features of the languages themselves.

i'm struggling really hard on doing the first exercises in the art of programming. they're about doing divisor calculation methods and i can't do modulo arithmetic. what do?

>Programming is about money, therefore the people who have the money decide what languages are good
and those people pick languages that have cost them millions and billions in the long term almost every time.
Literally no top-5 lang is there on merit and is almost unanimously agreed upon for being "just a fact of life".

I just don't want user to be as miserable as I am.
I was also just tired at one point and you need to turn that ship around quick.
>look at gay anime girls
You can do that while you're exercising.

No, Nim has been around for a decade and nobody I know or have heard of in any of my circles is using it. It's nothing to do with spam or memes or advertising. So it makes me wonder why that's the case. I'm reading through the documentation and nothing about it strikes me as bad, but nothing about it strikes me as "this makes me want to use this language over C++". Popularity is definitely a factor in how useful a language is, you have support, you have libraries, you have a tested and refined language

>and those people pick languages that have cost them millions and billions in the long term almost every time.
That's their problem.
>Literally no top-5 lang is there on merit and is almost unanimously agreed upon for being "just a fact of life".
That's because it *is* just a fact of life. What very rich people decide they like is a fact of life. If they change their minds, the facts of life change. I'm sorry but that's the world we live in.

but it's already almost 7pm, why even go outside
there's nothing good outside

>No, Nim has been around for a decade and nobody I know or have heard of in any of my circles is using it.
It takes a language atleast a decade after release to get any widespread adoption.
C++ went through it, and so did Haskell.
Nim's early days were pretty rough, and it was originally in turbo pascal and then switched. And they're just now getting 1.0 out.
D went through a python2/3 issue with their std tango/phobos debacle years ago.
So they had pretty rough luck, fucked up their first impressions and they paid for it.

learn modulo arithmetic

it's literally the simplest thing in the world, just take the righthand side of the modulo and imagine all the numbers up to that are in a circle instead of a straight line

consider this example of a number system mod 8:
0
7 1

6 2

5 3
4


now let's say we're at 1
0
7 1

>It takes a language atleast a decade after release to get any widespread adoption.
not really, it's variable. None of these languages are even approaching widespread adoption. They're just as dead as they were before.

How do I get intelliJ to actually resolve maven dependancies? I have a maven project and a pom but nothing is happening.

When a company like mercedes uses your language for something as bleeding edge as autonomous driving stuff, I think your language is doing fine. Granted I think D's usage is a bit more auxiliary than direct, but of all the languages they still chose it for a reason. And I think 28 companies around the world of varying size is not bad at all.
While Nim on the otherhand is not nearly as well off, as i think their core issue is people are confused about what the language actually is. And may be taking its python inspiration as just a python knockoff.

How do I stop being a NEET?

Attached: __hatsune_miku_vocaloid_drawn_by_haru431__e1857e049b0b44ff6d0b708162f1f77d.png (1000x1000, 281K)

get jobbe

Attached: silvere.jpg (904x1200, 305K)

>i think their core issue is people are confused about what the language actually is
You're right there, i'm also confused about its design philosophy

why would you do that

ask mcdonalds

I try. Not working.

kode*

What do I need to do to make a site like evernotes?I don't know what I don't know. I don't know where to begin.
I want to put this project on my resume.

Help a stupid person out here. I know some Java.

can i apply it to this method? one question says to just calculate the greatest common divisor of 2166 and 6099, but i can't tell if that's just a matter of reduction or one single step. it also says to rewrite this method but without using variable remapping.

Attached: Capture.jpg (711x205, 32K)

>I try. Not working.
Then try. Working.

Attached: piza hang glid.png (1600x1118, 1.53M)

>pom
upgrade to eclipse and *pomf*

Take Python's ease of use and almost pseudo-code syntax, give it the performance of a c-like lang, with the power of macros and AST manipulation of lisp. That's basically nim, and it does away with traditional class-based OOP in favor of a more simple type based approach.

>it does away with traditional class-based OOP in favor of a more simple type based approach.
but classes are types

Right click on the pom file, go to Maven, and Reimport.

But does it have as my libraries as python or c?

thanks, that worked

eclipse is garbage though

many*
Or as many users?
Or as much documentation?

Classes are hard to keep minimal and not overshadow everything else to the point that you have to program around them, rather than with them. That's why, while they /technically/ are types, they severely impair and limit you. While with single-inheritance types, you're free to program however you wish and they won't force to you design a certain way.
libraries, and users no.
Documentation is pretty alright.

what the fuck are you talking about? what is the difference between a class and a "single-inheritance type"?

>direct memory access
No NONONO OHOHOHONOOOOOHAHAHAHAHAHAHAHAHAHAHAH

The whole tools part of the ecosystem is garbage but at least eclipse works, works well, and works for free.

Jealous, whiteboy?

this was so fucking bad holy shit

Attached: Nightmare-Code-2015-09-18_960_640_80.jpg (640x960, 100K)

A class is an overbearing and fundamentally flawed system to establish and design things and their functions. It forces you to compartmentalize everything arbitrarily, and then also force you to then try to make rational relationships between different things and their systems. It's an oxymoron in practice, which is why behemoth OOP code bases are so grim to comb through and maintain.
While simple type aliases don't produce any of that, because it's getting back to how programming used to be, just types and free functions.

>code as verb

Attached: 1561870914927.jpg (882x731, 113K)

You read books? What a faget

Reminder that % is not a modulo operator, it returns the remainder of division. In math the modulo returns a positive value