/dpt/ - Daily Programming Thread

Old thread: What are you working on, Sup Forums?

Other urls found in this thread:

dominuscarnufex.github.io/cours/rs-kernel/en.html
docs.racket-lang.org/sicp-manual/
en.m.wikipedia.org/wiki/Mathematical_analysis
twitter.com/SFWRedditGifs

First for employed C++ programmer.

Lisp is the most powerful programming language. However, Lisp is shit, therefore, all programming languages are less powerful than shit.

>What are you working on, Sup Forums?
I'm working on the backend for a Wayland compositor. I'm trying to get it to work with multiple GPUs, but it fucking crashes and makes my computer unresponsive when I test it, meaning I have to restart my computer.
I would post a picture, but literally all it does it draw colours at the moment.

Tell me, is your compositor written in C by chance?

Yes.

dominuscarnufex.github.io/cours/rs-kernel/en.html
>Rewrite the Linux kernel in Rust?
>I do not write code for a living. Nor do I study computer science in university. And you know why this is great? ...

Rust people really are instane, aren't they?

Linux kernel should be rewritten in Lisp.

LOL no but the lisp os should be ported to more platforms.

>Cutting off the end of his statement
>And you know why this is great? Because it allows me to code completely stupid and useless things without anybody being on my back to tell me I shouldn’t. And what I am about to talk is precisely one of these codes…
But still, in general, most rust enthusiasts are fucking fervent, and probably aren't even programmers. They just fell for the hype and "safety" memes.
>You should rewrite this in Rust, so that it's more "safe".
>Why don't you do it?
>Oh no, I can't program.

void meme(int* a)

void meme(int a[])


Which one, Sup Forums?

In C, they are exactly equivalent. I would typically go with the first, though.

I know that they are equivalent, I just can't decide what to stick with.

The first one. You won't be working with arrays all the time.

Well you can use brackets with arrays and an asterisk with just a pointer.

After thinking about it, I realise that you're taking a jab at me using C, and that it's the reason the program is crashing.
No, I know what the issue is, and it's completely unrelated to the fact I'm using C.
It's to do with sharing DRM PRIME buffers across GPUs, and I'm pretty sure I'm not doing it properly. And since it's not working properly, my program ends up getting stuck in an infinite loop, and I have literally no way to close my program at the moment.

Just use the first, unless you're going to go with the fancy C99 VLA syntax.
void func(size_t n, int array[static n])

void meme(int a[static 1])

Maybe you should use a language that doesn't allow infinite loops.

No, the loop was actually expected, and is vital to how the program is supposed to clean itself up normally.
It'll work once I learn how to share the buffer properly.

Is SICP really that good?
Should I read it?

Yes. Learn Lisp.

I mean.. normally I w- wouldn't trust you guys, but if animu girls are reading it.. It's like I don't even have a choice..

Learn Lisp and watch Serial Experiments Lain.

>a language that doesn't allow infinite loops
The only language I know that does not allow infinite loops, or actually any loops at all, is BPF. But that's not a general-purpose language.

Do others exist? Just curious.

General purpose programming languages would not place that sort of restriction. It's literally undecidable for a compiler to check if any loop terminates or not.

pure book learning for c++ is really boring. Ive made a few programs with the skills ive learned (a wip text game with dynamic battle system being my best so far). What else can I do? I do the Sup Forums challenges as I learn how to do the underlying sill. Two threads?

how am i supposed to recourse if the compiler stops me calling myself

Forbid recursion.

pls.no.gif
recursion is love

I don't like this non-Turing complete programming languages meme.

but how else are the startbucks hipsters supposed to design programming languages, they can't figure out how to goto so they don't allow branching logic or functions, you just have to write your entire program in one long ass list of commands

Nobody is designing their languages that way, though. What the hell are you talking about?
If you're talking about DSLs, making them non-Turing complete is usually a good idea.

Which scheme implementation should I use for SICP?
Heard racket is good?

Sure. Follow this though: docs.racket-lang.org/sicp-manual/

if there a dsl that doesnt allow branching logic i havent seen it, give me an example brah im genuinely interested
i have only used a few, but even the most basic shit like ladder logic for plc programming allows it

could u pls explain how recursion is not-turing complete?

>pls no bully neko-chan

You are allowed to have branching in a non-turing complete language. You just wouldn't allow looping or recursion.
For example, the meson build system's files are deliberately not Turing complete.

thanks breh, i'll check it out, this is why i hang in /dpt/, you get educated real quick around here

I want to make 2 Instant messenger programs, for practice.

One in Javascript and the other in C#.
Hoping to make a portfolio by the time august is ending.

>you get educated real quick around here
Or you fall for the bait.

:^) fug i just installed meson and it compiled a loop just fine, bois help i got trolled what do?

>chat program portfolio
anyon pls

Only idea I have atm. Pls no bully.
What would you do Canadian-san?

well muh boi i'd pick an algorithm, read up about it, understand it then implement it, the language doesn't matter.
i'd recommend something interesting like an A* algo for calculating directions on a map or maybe if you are feeling particularly adventurous a b+ tree for searching a 1mil+ list of records in a physical file

you know.. just things that will separate you from the average pleb that is applying for programming work

C arrays suck. Not worth bothering with. So the first one.

Make awesome fizzbuzz in diferent shit languages, like the cool kids in /dpt/.

don't let people here influence you, a chat is OK you can add a lot of differents features, file sharing, chat rooms, contacts, security, etc.

aay

Languages that rely on the theoretical side of things to guide them are stupid. If you have a loop that takes more than a couple ms then make it an error until the programmer marks the code as halting. It should easily be able to do this. It doesn't catch all the cases but it's a good helpful feature.

To simply opt out of helping because you can't make the perfect solution is retarded.

>The halting problem doesn't exist if we just ignore it

It's not a problem if you aren't using a turing complete language

>777
vagina

Whats it like to be a employed C++ or C in fact programmer, share me your experiance becouse im going on that path.

>use libgdx
>forget how to java

To some extent yeah. But that's just a strawman you wrote up. It's clearly not what I was arguing.

>spent hours programming some exercise
>after I finished it, I saw the right answer and it shouldn't had took me more than 30 min
kill me

I want to see that guitar source code

hey guys so I'm making a game in c++ and I have no idea what I'm doing but it's actually kinda [spoiler]fun[/spoiler]

I've got classes mixed with procedural code and global variables all over the place it's a hot mess senpai and I'm loving every minute of it but I'm doing this one thing that I'm sure is a problem but isn't really that important per se

simplified pseudo-example:
class some_class {
std::vector stuff;
append(some_struct s) {
stuff.push_back(s);
}
remove() {
stuff.pop_back();
}
};
some_class some_global_object;
struct some_struct {
// whatever
};
void some_procedural_func() {
some_struct s;
// initialize values...
some_global_object.add(s);
}


so I'm passing these structs by value all over the place but what exactly is happening here? am I just allocating on the stack and leaking memory all over the place? or do the stdlib containers allocate and free memory behind the scenes? what's the actual right way to do this I'm sure pointers are involved somehow but I literally don't know how

Failing to do anything in OpenGL.

I'm currently saving up for a CS degree in a foreign university. I thought I'd read up on all the material beforehand to get a slight edge when I actually get there.

It says here that there will be a class named "analysis". What does that actually mean in computer science?

here's the full list:

12 CP
Analysis
8 CP
German/Italian
8 CP
Introduction to Programming
8 CP
Architecture of Digital Systems
4 CP
English
8 CP
Data Structures and Algorithms
8 CP
Advanced Programming
8 CP
Introduction to Management Engineering

Thanks man!

>meme
>memes
I don't want reddit stink nearby. Fuck off.

>You just wouldn't allow looping or recursion.
This is wrong and retarded.

Please tell me how something would be turing complete if you can't loop or use recursion?
A backwards goto counts as looping; indirect recursion is still recursion.

>It's literally undecidable for a compiler to check if any loop terminates or not.
Wrong.

I never claimed anything like that. I just said that "non-Turing complete languages don't allow recursion" is a retarded statement.

I'm currently trying to learn programming, and how the hell are you supposed to choose what IDE/text editor to use? Does it just come down to what languages you're focusing on?

If a non-Turing Complete allowed recursion, it wouldn't be non-Turing compete.

I'd assume that's a math course. But I don't know about your university. Ask them or search some more.
en.m.wikipedia.org/wiki/Mathematical_analysis
Not that guy. But it is in a Turing complete environment. Unless you're being picky and interpret 'any loop' as meaning an arbitrary loop. The intent here is clearly to express that there are loops where you can't tell.

just use vim

Actually, I realised my statement isn't entirely accurate. You need conditionals too.

Yes mostly languages have various support in various IDE.
If you're new it makes the most sense to pick what seems the most popular.
It's not that important really. Some have preferred to learn without, I don't.

>various support in various IDE
Varying support in various IDE.

You're talking about general recursion.
This isn't written in a Turing complete language.
_+_ : ℕ → ℕ → ℕ
zero + x = x
succ x + y = succ (x + y)

Lmao fuck off.

>But it is in a Turing complete environment.
Irrelevant garbage.

This

Is this a joke or do you genuinely have a mental deficiency? The halting problem is about a general algorithm which decides halting for every single program in a Turing-complete language.

we also have an analysis course, it's calculus

>The halting problem is about a general algorithm which decides halting for every single program in a Turing-complete language.
Yes, I know.

If it's a single int pointer: the first one and if it's an array the second one.

That poster was talking about special cases of the halting problem, a lot of which are obviously decidable.

so it's mathematical analysis

thanks guys

>a lot of which are obviously decidable
Sure, but restricting it to that MASSIVELY reduces the power of your programming language, makes it non-Turing complete, and pretty much makes it useless in general.
You couldn't even write something as simple as
int c;
while ((c = getchar()) != EOF) {
printf("You entered %c\n", c);
}

I name my classes in lower_snake_case.

>adding an optional feature reduces the power of your programming language.
Interesting. I'd like to hear the reasoning behind this. If there was any.

>optional
Who mentioned anything about optional?

>but restricting it to that MASSIVELY reduces the power of your programming language
Only if you're interested in researching computable functions.
>makes it non-Turing complete
Not if you read his posts. He obviously said the programmer can mark any code he wishes as "halting".
>and pretty much makes it useless in general
Non-Turing complete languages are superior in every way.
>You couldn't even write something as simple as
You could. Any sane language distinguishes between productive recursion and infinite looping. This loop always produces a result in finite time. Which is obviously not the same as an empty while loop.

He literally said the programmer could mark any code as halting.

>programmer marks the code as halting
Sure. You may find the default annoying. Which might be solved by having a scoped declaration of the preferred default or whatever solution fits you.

But it's clearly optional.

productive corecursion

&

Is Visual Studio Code a good one to get started with if I want something that runs on both Windows, Linux and OSX? The other alternatives I've seen that seem the most popular are Atom which people say has shitty performance, Sublime which costs money and Vim/Emacs which feel too autistic for someone who's just getting started.

>Sublime which costs money
hehehehehehehe

Sublime is effectively free as in beer.
I'd prefer atom (which does have shitty performance but it's just a text editor, it works) but they're all fine alternatives.

SQL problem

Whatever I insert into a column marked as double is being set to 1.000...

what am i doing wrong?

Reddit is so in love with Rust. Whenever I call it a meme language they flip out.

So you visit R*ddit?

Only place with IRC where you can talk about ocaml and lisp.

Also IDE usually have things like debuggers. These (excluding vs code) don't really have good debugger support. These are text editors. They may have linting and autocompletion but they're not actually IDE to any serious extent. Just so you know. An IDE tends to handle how you build, run and configure the runtime environment for your program. NetBeans, Visual Studio (not VS code), eclipse etc are examples of IDE.
Just saying that so you're not confused about terminology. There's nothing wrong with using text editors and build scripts. It's very common to at least use a separate text editor (because a lot of IDE kinda suck at that front).

I don't want reddit stink nearby. Piss off.

I have this extremely simple C++ function to write stuff to console:

template
void disp (T input)
{
std::cout