/dpt/ - Daily Programming Thread

Anime edition

Previous thread: What are you working on Jow Forums?

Attached: code_master.png (1164x1738, 2.17M)

Other urls found in this thread:

isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
twitter.com/SFWRedditVideos

Lisp is the most powerful programming language.

Attached: 1537727371475.jpg (1280x720, 195K)

I've tried not doing anything and I just end up sleeping a lot.

I've thought about a live2d clone but I have no artistic ability so I wouldn't know how thing deform in perspective.

It certainly is

Attached: list_most_powerful_lang.png (380x120, 16K)

I am designing a language with two complementary fragments. One is an applications level functional language and the other is a systems level imperative language. The rough idea of their interaction is that the FPL may be used to verify the correctness of the IPL and the IPL may be used to provide runtime support for the FPL.

So C++

Attached: 1541383003616.png (499x338, 38K)

sounds like your understanding of programming consists entirely of internet memes

...

I'm not him, but I have no clue what you're talking about.

I mean that sounds extremely trendy and extremely nonsensical at the same time

A C++ calculator right now. Then Im looking to get into QT and give it a gui. after that I dont know.

Name me one language that does that.
You can't.

thats because it's pointless

there are languages that integrate both

do you guys have any recommended resources for learning QT?

I said name them

No you said name a language that does the dumb shit you're doing

And you didn't name any.
And I'm not him.

Yeah I didn't name any that did the dumb shit he's doing, now what the fuck are you crying about if you're not even him

Notice a ton of people saying you should only use std::unique instead of new now.
Are they right?

Attached: 1513749273436.jpg (640x639, 57K)

>what is refinement calculus

>now

Just use C++ as C with lambdas

no

Yes, please please please use smart pointers. Use fixed width ints. Use RAII. NEVER call new.

Another day another C++ feature people are told not to use

Does autohotkey count as programming?

No, smart pointer are gay.

gay_ptr

I think those people are saying you should use smart pointers not raw memory allocations.

It's understandable if you're dealing with lifetimes in that way. But often these people are low-end systems programmers who think that the standard covers everything you might do in the language. Or they're people who stand to benefit from portraying that.

Use of the ahk scripting language is programming.

Generally if I do something like this

if (condition1)
if (condition2)
do something
else
do something else

will the else belong to the second if or the first? (Assuming a language that typically uses {} to denote blocks and not something like Python where it's dependent on the whitespace)

depends where you put your closing bracket

I dont have a clue

This is old advice
isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
One of the slowest pages in existence for just displaying text made by Bjarne and Herb. Excellent.

Then you should probably not accuse others of ignorance.

I didn't accuse you of ignorance I accused you of being a trendwhore who lacks real understanding of programming

Assuming no brackets are used at all. Like many languages don't require the bracket if you only put a single line under your if but I'm not sure what happens if that line is another if with an else attached. My instinct is that the else would be attached to the innermost if but I haven't actually had a chance to test it besides in AHK which idk if counts as a real programming language

it will be the innermost in that case

if(bool)
if(bool2) do something ;
else do something else ; //this is executed if bool2 is false

if(bool) {
if(bool2) do something;
}
else do something else; //this is executed if bool is false.

Don't mix no brace and brace syntax between ifs and corresponding else's like here.

If I use RegisterShellHookWindow to receive messages from the shell, will this block other apps that need the same info until my app finishes what it's doing? Or do all listeners receive this info in parallel?

You can easily test it. Just pause on a message. See if the application still works.

Nobody will ever use your language. You won't even complete it. One day you'll leave the project unfinished and forget about it just to find it by accident in like 2030 on some old crusty flash drive and you'll have many good keks at your young stupid self.

Starting on a gold per minute calculator for in game currencies, with some graphs for comparison. Allows for importing data sets. Adding on will be a full gui and the ability to save and build data sets on the fly with timers and market links

>Use of the ahk scripting language is programming.
Use of the ahk scripting language is scripting.

ftfy - before you start calling javascript or batch scripting programming as well.

don't do that

What's the difference?

Go correct Wikipedia if you care so much about this.

yes since ive made 5K creating ahk scripts

>5K creating ahk scripts
Who the fuck buys ahk scripts.

people

what programs are you even making themfor?

I've been getting into gamedev recently and just realised that I don't know shit about programming, even when I watch tutorials for game maker or something some of the code and relations between the objects or whatever seem like utter nonsense. Please recommend me a retard friendly language/programming course so I can get a basic (or even a decent) understanding of this shit.

Attached: 1541727035200.jpg (1280x720, 806K)

how the frick do i stop SDL2 PollEvent() from eating 30% cpu?

Attached: 1531965446098.jpg (695x697, 471K)

>how the frick do i stop SDL2 PollEvent() from eating 30% cpu?
Stop calling it as fast as possible in a tight loop?

Do regular applications have a delay in their event loops? if yes how much ms?

Starting out programming Python would be my recommendation. Its easy to understand, easy to run and fast. They have great documentation on their own and plenty of third party ones.

Its also very general, so it works for a lot of tasks.

Use WaitEvent instead. You don't need to poll that shit as fast as you possibly can.

"Properly" written applications will use multiplexed I/O, and block on that while they wait for something to happen. I don't think gaymes are typically written in that fashion, though.

>Do regular applications have a delay in their event loops? if yes how much ms?
I assume you're making a game, so whatever the update rate is?

That is if you aren't actually interested in the science behind it.

Starting out on the low-levels of abstraction has lots of benefits, but isn't as rewarding or useful at first. Without tons of motivation its easier to start up high and work your way down as needed

Im actually writing a text editor to learn C and low level programming using SDL2. WaitEvent() makes sense in this case.

(no bully)

Attached: sayak mem face.png (614x356, 45K)

>SDL2
You can go lower than that.

I was thinking about trying Python as well

So what's your point? Should I start with C++ or C# or something instead? Please elaborate

Of couse i could use DirectDraw and winapi but then how would i port it to my Switch? heh

C++ users aren't satisfied using a toaster unless there's an 11 percent chance it can cut your hand off based on 7 contextually dependant buttons you can push.

You can ultimately use whatever you like.
However raw pointers do come in handy in particular situations.

>text editor
>using SDL2
Umm... why? In any case, the easiest thing to do in your case is to yield back to the OS using SDL_Delay(1) or whatever after every frame.

Python so you're able to implement your shit as you go, C so you understand what's actually going on. If you can't do both at once you suck and have no right to live.

I set up one of my useless Pi's to mine Skycoin, so now it finally has a purpose

i kinda wanna make my own normal map generator, working through rendering right now and i realized they're all made by faggots

Going by a few articles which talked about how to get the best out of other faggot's generators and how you're supposed to use a height map, I assume they use the rate of change of the color gradient to suss out the hypothetical angle/steepness?
other than the fact that opencv would probably be involved somehow on account of being image related i know nothing about image processing

sepples btw

>Umm... why?
For fun!
Other than that i always preferred GUI text editors over terminal ones and i figured it would be a fun project. What would you use user, to write your very own text editor?

Attached: senpai.jpg (305x304, 33K)

>Python so you're able to implement your shit as you go, C so you understand what's actually going on
This is why you should never listen to /dpt/ retards. C vs. Python makes absolutely zero difference for "understanding what's actually going on". If you really want to do stuff from scratch, you can write your own game engine and render using plain OpenGL just the same.

There are many low level components and libraries on your operating system that is written in C.
Without knowing C, there is no way to understand what's truly going on down there and use a lot of these APIs directly.
Sure, you can use other higher level languages, but it'll either be wrapped to all hell or incredibly annoying or difficult to use.

>If you really want to do stuff from scratch
Not really, I just want to get an decent understanding of programming so I can fuck around in game maker studio without losing my shit over what each programming line means

>Should I start with C++ or C# or something instead?
Don't bother with C++ unless your goal is explicitly to learn C++. Python should be fine for a start, unless you're expecting to write a high performance 3D game engine as your first attempt at a game (which is stupid).

>Without knowing C, there is no way to understand what's truly going on down there and use a lot of these APIs directly.
Unless you care about platform-specific details of how to create a window/get an OpenGL context/poll for input etc., that point is completely moot. As far as game development is concerned, none of it is actually relevant anymore because everyone at least uses something like SDL to abstract such platform-specific details away.

Start out with Python, and learn C++/C# afterwards.

Personally I think lower level components are easier to understand once you have something to relate them to, and the energy to learn from building something worthy and useful before.

Reminder that the web and modern software would be 100000x faster if no one used scripting trashlangs and people actually cared about efficiency and performance instead of being in the "lmao computers are sooooo fast nowadays u'r just wasting ur're time microoptimizing" mindset.

If you aren't programming in modern C++ with efficiency in mind, then turn off your computer, get up, walk away, and never ever come into contact with another computer again for the rest of your life.

>I just want to get an decent understanding of programming
Then pick any mainstream language.

Reminder that 90% of the most bloated, buggy, slow and exploitable software out there is written in C++ based on retard-tier reasoning like yours.

If the web was built in C++ it might be 10 times faster but there would be 10 times less shit on it
The web is slow because it can get away with it without any noticable drawbacks

>What would you use user, to write your very own text editor?
An actual GUI library, if I wanted to make something legit. If you just want to play around and reinvent the wheel for the sake of learning, I guess what you're doing is fine.

>most bloated, slow
That's electron
>buggy
That's C

>but there would be 10 times less shit on it
That's probably good
>any noticable drawbacks
ahem
*takes multiple seconds to load something trivial that should've loaded immediately*
y-yeah, n-no noticeable drawbacks, h-haha

>That's probably good
not really considering the purpose of the internet
>*takes multiple seconds to load something trivial that should've loaded immediately*
that's your network latency most of the time

Modern "trashlangs" are in fact often fast enough to think about cpu cache misses.

Its their ease of use that enables more less-competent people to write software. This means cheaper workforce -> cheaper softrware -> new markets and more business.

Keep up your blatant denial. It won't change the fact that C++ accounts for most of the worst software out there.

>that's your network latency most of the time
Wrong.
Some sites are just bloated slow pieces of shit that do not justify the load time.
Meanwhile some others load way quicker and are more responsive while doing more.
If 90% of the absolute trash disappeared on the internet few non-retards would care.

>Its their ease of use that enables more less-competent people to write software. This means cheaper workforce -> cheaper softrware -> new markets and more business.
Was this supposed to be an argument in favor?

You can't even name them.

>*takes multiple seconds to load
You can write bad code in any language. My PHP site renders in 7-20ms and contains tons of dynamic content.

I don't use social media shit but I can't think of a website that takes a long time to load because it's running bloated scripts on my computer
Websites could load faster if they didn't have those scripts to begin with but thats like cutting things down from 2 seconds to 1 second

I wasn't only talking about language, I was talking about mindset too.

>Was this supposed to be an argument in favor?
It is an explanation. You don't have to belong to an either extreme.

>My PHP site renders in 7-20ms
a video game with an entire high resolution 3D world renders in 16ms yet a website with some text takes longer

>You can't even name them.
Literally pick any major piece of software that's slow, bloated and buggy. Chances are, it's written in C++. It's time you retards start to acknowledge that C++, and C++ "programmers", consistently fail to deliver in terms of quality and efficiency.

>a video game with an entire high resolution 3D world renders in 16ms yet a website with some text takes longer
The browser is written in C++.

your browser doesnt render php

The browser would be 100x slower if it was written in any other higher level language.

Reminder that C++ gets simpler and easier with every standard revision.

it renders what php delivered