/dpt/ - Daily Programming Thread

Old thread Wanna chat? Join #dailyprog on rizon
What are you working on?

Attached: 1538580916967.gif (430x530, 1.98M)

Other urls found in this thread:

strawpoll.me/16604780
en.cppreference.com/w/cpp/language/attributes/contract
twitter.com/SFWRedditImages

Reposting snake CHIP-8 game on a led screen controlled by 4x4 keypad, sound played on a tiny buzzer

Attached: led_output.webm (1920x1080, 1.15M)

I'm the learning python guy from last thread.

Also curious, I like playing diablo 2 but I find the grind oddly tedious. Like I wish I had an auto button to play the mindless parts without me and take over for the fun bits.

How do I do that? would that be something I can do with python?

In assembly, are immediate values stored in a register temporarily?

I dunno about diablo, but runescape does pretty extensive botting.

Immediates stay in the instruction itself. The cpu might use a hidden register or something, but none of the accessible registers are modified. IIRC, MIPS has a read-only zero register.

It depends.
Small enough immediately are stored directly in the instruction. Larger immediates need to be constructed inside a register with two or three intermediary operations. Or just loaded from a literal pool, usually placed at the end of a function.

looks great desu
now make it two player

Note the shadow snake, that's player 2

alright
cool

Thanks

>Wanna chat? Join #dailyprog on rizon

FUCK

OFF

>t. discord employee on unpaid internship

What the fuck makes you think I'm shilling for discord?
I'm saying FUCK OFF with any and all chat shit including discord, IRC, or whatever the fuck.
Just fucking post in this thread for fucks sake. Or better, fuck off and kill yourselves instead so we don't have to deal with you fucks in our thread.

There has never been any sort of official "chatroom" or anything for these threads, no matter if it's gaymur shit like discord or even IRC.
Fuck off and stop posting extra stupid shit in the OP.

>contribute to the FOSS project meme

I agree with this guy.
any doings on the side kills these threads because ego's in chat.

>replying no normalfags
just stop you dweebs.

>Just ignore them and let them shit up the thread and OP
How about you fuck off and kill yourself alongside them

IRC and discordfags are the worst
>Split up the community, lower activity in thread on Jow Forums
>Thread eventually dies out
>Now there is no new people coming in, since IRC and discord aren't as easy to find as a Jow Forums thread
>IRC and Discord eventually dies out too because there haven't been any new users in years

This literal aids needs to stop

text editor poll continues:
strawpoll.me/16604780

Attached: editor-latency-windows-text-vs-xml[1].png (580x490, 27K)

>atom
>all over the place
It's such a shame. I like atom on an interface level but everything else about it sucks.

Why the fuck is geany not on this list?
Fuck off and stop posting it. It's shit.

try VSCode, its better

show me how you actually use geany with some project that's not fizzbuzz and it will be in next poll

>He runs an ENTIRE chrome + v8 instance
>Of which inside of he runs an ENTIRE website
>Just to edit some text
Jesus fucking christ

>Step 1: open your files
>Step 2: navigate to where you want to edit
>Step 3: start editing
HUUURRRR
Pic related

Attached: 1514225248331.png (1198x1005, 132K)

nice

>He runs an ENTIRE chrome + v8 instance
>Of which inside of he runs an ENTIRE website
>Just to edit some text

que in ed pasta

call me when Geany has extensions for every language, built-in github, a built-in shell, a built in debugger, extensive marcos, binds, emacs-like key combos with optional vim-input styles. And easy ricing and config via hot-loaded json values.

>leading underscores on nonstatic identifiers
stop

>geany
geany is great for quick scripts and shit like that. Anything more in depth geany is useless for though. I love geany though

int main(string[] args) {
import gio.Application : GioApp = Application;
import gtkc.giotypes : GApplicationFlags;
import gtk.Application : Application;
import gtk.ApplicationWindow : ApplicationWindow;

auto app = new Application("org.gitlab.radagast.gtkdnote.textview",
GApplicationFlags.FLAGS_NONE);
app.addOnActivate(delegate void(GioApp _) {
auto aw = new ApplicationWindow(app);
scope (success)
aw.showAll();

aw.setTitlebar(() {
import gtk.HeaderBar : HeaderBar;

auto hb = new HeaderBar();
hb.setTitle("Entry Demo");
hb.setShowCloseButton(true);

return hb;
}());

aw.add(() {
import gtk.Box : Box;
import gtkc.gtktypes : GtkOrientation;

auto vbox = new Box(GtkOrientation.VERTICAL, 5);

import gtk.Entry : Entry;

auto entry = new Entry("Enter your name", 80);

vbox.packStart(entry, true, true, 0);

auto hbox = new Box(GtkOrientation.HORIZONTAL, 5);

import gtk.CheckButton : CheckButton;

auto checkEditable = new CheckButton("Editable");
checkEditable.setActive(true);

/*
IMPORTANT NOTE: The delegate below takes a ToggleButton
as its parameter. `gtk.CheckButton` inherits from
`gtk.ToggleButton` so passing a CheckButton is allowed.
*/

import gtk.ToggleButton : ToggleButton;

checkEditable.addOnToggled(delegate void(ToggleButton _) {
static bool activate = false;
entry.setEditable(activate);
activate = !activate;
});

hbox.packStart(checkEditable, true, true, 0);

vbox.packStart(hbox, true, true, 0);
return vbox;
}());
});
return app.run(args);
}

Attached: 1536461729788.jpg (560x560, 34K)

So I've been looking to get into 3D graphics in C++ with opengl/vulkan but I've been thinking whether I should do that or just learn how to 3D model?

>an api with delegates
I love D and all, but this seems incredibly shitty.

>que in ed pasta
?

>extensions for every language
You only need highlight support, and it has it for every relevant language.
>built-in github
Definitely cancer you don't need or want. But there's probably a plugin
>a built-in shell
Definitely cancer you don't need or want. And already has it.
>extensive marcos
Definitely cancer you don't need or want
>emacs-like key combos
Definitely definitely cancer you don't need or want. There's probably a plugin
>vim-input styles
There's a plugin.
>And easy ricing and config
It's definitely easy to config and rice. The dark theme your seeing in the text editor widget is my own theme.
>json values
Definitely cancer you don't need or want

Those a private methods. The reason the underscores are there is because there are already public methods with those names which wrap them.
_set is used in multiple locations which need access to the underlying cell which is why I factored that logic into a private method with such an ugly interface.

Forgot to quote

>deadlang
>glib trash

Attached: vomit.jpg (650x650, 90K)

Abusing delegates is my choice to be honest. I think it keeps your function stack clean. You can easily use free functions instead. But Gtk event handling (like that of Java Swing) is heavily dependent on function pointers or delegates.

Attached: 25591838.jpg (743x635, 47K)

When I log into my Xenix system with my 110 baud teletype, both vi and Emacs are just too damn slow. They print useless messages like, ‘C-h for help’ and ‘“foo” File is read only’. So I use the editor that doesn't waste my VALUABLE time.

Ed, man! !man ed

ED(1) Unix Programmer's Manual ED(1)

NAME
ed - text editor

SYNOPSIS
ed [ - ] [ -x ] [ name ]
DESCRIPTION
Ed is the standard text editor.

---

Computer Scientists love ed, not just because it comes first alphabetically, but because it's the standard. Everyone else loves ed because it's ED!

“Ed is the standard text editor.”

And ed doesn't waste space on my Timex Sinclair. Just look:

-rwxr-xr-x 1 root 24 Oct 29 1929 /bin/ed
-rwxr-xr-t 4 root 1310720 Jan 1 1970 /usr/ucb/vi
-rwxr-xr-x 1 root 5.89824e37 Oct 22 1990 /usr/bin/emacs

Of course, on the system I administrate, vi is symlinked to ed. Emacs has been replaced by a shell script which 1) Generates a syslog message at level LOG_EMERG; 2) reduces the user's disk quota by 100K; and 3) RUNS ED!!!!!!

“Ed is the standard text editor.”

Let's look at a typical novice's session with the mighty ed:

golem$ ed

?
help
?
?
?
quit
?
exit
?
bye
?
hello?
?
eat flaming death
?
^C
?
^C
?
^D
?

---

Note the consistent user interface and error reportage. Ed is generous enough to flag errors, yet prudent enough not to overwhelm the novice with verbosity.

“Ed is the standard text editor.”

Ed, the greatest WYGIWYG editor of all.

ED IS THE TRUE PATH TO NIRVANA! ED HAS BEEN THE CHOICE OF EDUCATED AND IGNORANT ALIKE FOR CENTURIES! ED WILL NOT CORRUPT YOUR PRECIOUS BODILY FLUIDS!! ED IS THE STANDARD TEXT EDITOR! ED MAKES THE SUN SHINE AND THE BIRDS SING AND THE GRASS GREEN!!

When I use an editor, I don't want eight extra KILOBYTES of worthless help screens and cursor positioning code! I just want an EDitor!! Not a “viitor”. Not a “emacsitor”. Those aren't even WORDS!!!! ED! ED! ED IS THE STANDARD!!!

TEXT EDITOR.

When IBM, in its ever-present omnipotence, needed to base their “edlin” on a Unix standard, did they mimic vi? No. Emacs? Surely you jest. They chose the most karmic editor of all. The standard.

Ed is for those who can remember what they are working on. If you are an idiot, you should use Emacs. If you are an Emacs, you should not be vi. If you use ED, you are on THE PATH TO REDEMPTION. THE SO-CALLED “VISUAL” EDITORS HAVE BEEN PLACED HERE BY ED TO TEMPT THE FAITHLESS. DO NOT GIVE IN!!! THE MIGHTY ED HAS SPOKEN!!!

Fuck off

>bunch of useful features to be productive out of the box
>cancer you don't need or want

What useful features?

>phone interview
>haven't talked to a human being in 2 weeks

Attached: Selection_357.png (640x434, 196K)

What possible use does contracts have when it's not even zero cost?
Why would the committee add this?

Contracts are just asserts with different syntax. The cost is the same either way - you turn them on while you debug and turn them off when you don't.

>Contracts are just asserts with different syntax.
no

Prove they aren't.

contracts are either executed before entering or after exiting a procedure. they are not part of the definition but of the declaration.

In C++20, that's what they are.
If a given predicate is not satisfied, the program raises an error - and whether this predicate is checked depends on a compile time flag. That's what an assert is.

See? asserts.
Just with different syntax and restrictions

You mean they're a part of function types?
std::is_same_v 0]]> == false?

IRC is quite dead. Would agree

Don't think so, otherwise it would be ambiguous which to call.
It's probably just the same situation as with noexcept before C++17. Not actually part of the type.

i mean that a contract shall not be part of the implementation.

int (*sort)(array *foo)
pre { foo != null }
post { isSorted(foo) == true };

That's not how shadows work

Attached: nice_dick.png (540x172, 106K)

You can put an [[assert]] in the implementation though

It's an approximation of global illumination.
It just has hard edges instead of soft edges.
The real question here is, what the fuck is Akari doing?

sort is a pointer, fuck tard. Contracts takes all their power when the implementation is unknown. UNKNOWN.

Wait, is what you posted valid C++20 syntax?
What does it do?

i am talking about the concept of programming with contracts in general. i don't know about c++ and i don't want to know.

Then stop talking about things you don't know about.

C++20 contracts don't use that syntax but roughly have those semantics.

Cppreference describes how they work nicely.

But can you use contracts with function pointers? That's what I wanted to know.

Doesn't look like it.

en.cppreference.com/w/cpp/language/attributes/contract

precondition: A precondition is checked by evaluating its predicate immediately before starting evaluation of the function body
postcondition: A postcondition is checked by evaluating its predicate immediately before returning control to the caller of the function
assertion: a condition that should be satisfied where it appears in a function body.

see, even without knowing c++, i was right. this is why it is important to learn programming techniques and concepts by reading PLT literature instead of how a specific programming language implement them.

>i was right
No you weren't. You can't use it with UNKNOWN implementations like you said.

Contracts are visible at the declaration site of a function.

Yeah and?
You can't use it with function pointers.

they are not dynamic but this is a limitation of C++. you can still do

... foo(...) ...;

and let someone else implement f

I'm getting really good at cooking curry

Attached: 1538268566859.gif (600x542, 1.85M)

Post curry

Attached: 1520726725497.png (1024x946, 179K)

Too bad I ate them all

Attached: RFO-1400x919-DavidsCurry-03186c71-75ff-4976-bf1f-24ca8c9aa06c-0-1400x919.jpg (1400x919, 275K)

(define (currying proc arg) (lambda args (apply proc arg args)))

((currying (currying + 3) 7) 8)

=> 18

Attached: racketlog.png (512x512, 142K)

None

Not the autistic kind

Attached: 26000865.jpg (938x720, 59K)

based and redpilled post
>lisp
disgusting

Attached: 1467672038292.jpg (721x720, 84K)

yeah, sure. do the same in C.

Attached: church_alonzo.jpg (340x282, 17K)

Turing machines > lambda calculus

why?

no one cared about the Turing machine, his paper remained unnoticed for a long time.

Attached: turing.jpg (678x800, 52K)

Gross

turing was a fag
lambda calculus on the other hand was divinely inspired

...

Fuck off wrong thread.

he's asking for a programme

Until it got noticed and became huge.
Face it, turing machines are just better and lend themselves well to being implemented as CPUs.
Lambda calculus is USELESS.

Agreed.

Fuck off still wrong thread.

>Lambda calculus fags have to run their useless shit in a turing machine for it to even work
LMAO

>Until it got noticed and became huge.
no. when it got noticed, computers were already a thing for years.

/dpt/ is a friendly helpful thread for friendly helpful programmers

Attached: 1536781672997.jpg (514x524, 58K)

No. /dpt/ is for discussing PROGRAMMING.
/dpt/ is NOT for homework, program requests, or ANYTHING ELSE other than PROGRAMMING.
This isn't your safe space. Fuck off.

>gatekeeping
kek

/dpt/ is friendly !!! /dpt/ loves newfriends !!!

Attached: 1533851981396.png (873x1079, 929K)

same for every programming languages or mathematics but it's of no importance because of abstraction.

>Restricting the thread to what it was meant to be is gatekeeping
Yeah, lets just all discuss irrelevant things which have nothing to do with programming in the programming thread.
How about fuck off and kill yourself instead. I come here to see programming discussion, because after all, IT'S FUCKING CALLED THE DAILY PROGRAMMING THREAD.

DAILY

PROGRAMMING

THREAD

DO YOU SEE THE WORD "PROGRAMMING" IN THERE?
THINK FOR A SECOND. THERE'S A _VERY_ GOOD REASON THAT WORD'S IN THERE.

yeah it's the [daily programming] thread and that guy wants a daily program for his medicine so fuck off. punk.

>turingfags have to run their turing programs on von neumann architectures
>imperitards' impure mutable code is simply an abstraction on top of purely logical register operations

>He has to rely on abstractions (turing machines) to run his useless lambda calculus
>He can't even implement a universal lambda calculus machine in hardware
Utter USELESS

Singles agree