/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1492871827629.jpg (1440x810, 188K)

Other urls found in this thread:

hackage.haskell.org/package/htaglib
news.ycombinator.com/item?id=16518726
twitter.com/SFWRedditGifs

>tfw programming anxiety

Attached: 1547156513084.jpg (2335x2507, 685K)

game-specific optimizations are fairly high-hanging fruit at this point, the biggest advantage you have from rolling your own tech is creating better tools and content pipeline, you probably won't be doing anything you can do game-specific optimizations for

game that perform badly with those engines are the fault of the developer, not the engine

Is it possible to write a function in C++ that takes input like this:

int x = 2;
my_function("here was a number "

You will perish

>game that perform badly with those engines are the fault of the developer, not the engine

so you're saying that those engines are perfect?

JavaScript rocks!

Attached: js-rocks.png (1000x494, 368K)

No.
C++ operator overloading requires at least one of the arguments to be a custom type.

I'm not even sure what you're asking desu

there's no such thing as a perfect game engine
UE4 is capable of making games that run great and games that run like shit, it depends on the developer
I dont know enough about Unity to say

Can you make a fixed point function over types in C++?

no but you can do
my_function("here was a number", x);
or if you hate yourself you can do
my_stream_object

thanks, I know what to do now.

I was just hoping I didn't have to make a custom class and overload operator

what the fuck is your question though

>overloading operators
Should be illegal desu

>my_function("here was a number", x);

Hmm but I need variable number of arguments, guess I could do varargs.

fuck off, others understood it fine.

I often implement something really complex first and then reduce it after I can recognizing all the repeating patterns. Is this expected or should I be able to write simple versions to begin with?
How is the "from scratch" process typically like for you?

Attached: 173151a28a0b6b5ceb15ae9fc739d178f42f9640cb3457d0cf32e4c7123d9af2.png (255x255, 4K)

thats normal

When I'm planning something, I do the top level code(how I think it should look) and data types first. Then I implement the procedures and refine what needs to be changed.

Not sure I would call it complex, it's more like really ad-hoc, full of magic numbers and basically brute force my way to get it working, then I start cleaning it up (if needed).

The people who have are "able to write simple versions to begin with" end up being either famous or millionaires or both. Guys like Torvalds or John Carmack.The rest of us have to grow/evolve our software.
The upshot is even if you're one of those who has to stumble half-blindly towards the light, you can learn to grow your software in a controlled way so that you end up with a nice bonsai tree and not a mutant tumour with a face.

==HIROSHIMOOT KILLED Jow Forums==

Attached: HiroshimootKilled4chan.jpg (600x471, 86K)

Perfectly normal. I do it as well. Very few are smart enough to see all the problems beforehand and plan around them accordingly.

going to repost this from last night because it still bothers me (and from last thread since I didn't realize it was dead):
I've been learning haskell as my first real language (I learned some java in highschool but that class was so sad I don't even consider it programming)

I'm at the point where I want to make something neat for myself as a learning experience; namely I'm planning on making a program that pulls all unique ID3 album tags from .flac and .mp3 files and writes them to a folder.
Unfortunately the module I want to use, htaglib, isn't installing with stack. I get the same error that is listed on the hackage pages reported build failures, something about a failed tag_c library. I have the C library installed I think, I did dpkg -L libc6 (which debian is telling me is the "latest version") in my /usr/share folder and /usr/include folder. Is this the standard install location? I tried using the --extra-libs-dir= and --extra-include-dir= args when installing htaglib, but no matter what path I chose I still got the same error; missing or possibly corrupted C library: tag_c.
This is pretty frustrating. I guess that's what I get for using debian stable.
hackage.haskell.org/package/htaglib

>haskell as my first real language
Nigger, what are you doing??

...

using C libraries is probably inconvenient for a first real language because you may have to mess with linking

You might want to reconsider learning Haskell if you can't manage to install a lib from source.

not him but Haskell itself isn't that bad if you put time in

CUDA C/C++ book recommendations?

I like to make insanely overcomplicated spaghetti solutions with 30 flag variables for every function so that changing anything has some bizarre side effect. Then I to make everything even more spaghetti by mashing huge functions together to create these 2000 line behemoths of functions that take 20 arguments and leak side effects everywhere. The more rube goldbergian I can make these functions the better.

I make oracle look simple and elegant

pure degeneracy

I mean I never installed it, just came with the distro. If I could find a source that I knew contained tag_c and shit I could maybe install it from source myself, but I'm still pretty retarded when it comes to linux.
My understanding was that function programming is the hardest to learn after you've become used to imperative. So I said fuck it. I honestly really enjoy it so far, the more concrete way functions work and their relation to mathematical notation has been pretty easy on my brain. Still haven't gotten to monads yet though.
Yea, I saw. I'm gonna try some of the other "low-level" modules that were described in the htaglib page, but I'd like to figure this one out because it's not the first time a program has been unable to find a common library. It's been happening ever since I installed debian.

holy mother of based

post some code you wrote yourself

Attached: scrot.png (2404x1772, 710K)

Attached: madoka.jpg (680x680, 85K)

is it worth using all the different data types in c#? feels pretty stupid to go heavy on the typing

technically you could do something like this:

#include

using namespace std::literals::string_view_literals;

struct my_data { std::string_view sview; int value; };

auto operator

Seriously though

How much would you have to get paid to work this job?

How long before you'd start think of kysing yourself daily?

Attached: but why.png (1146x550, 84K)

sequence (map f xs) is mapM f xs or traverse f xs

I'm coding!

rate pls

>no
dropped

youtube tutorials mislead me

Attached: 45636060_2184093981831087_2036659077852954624_n.png (253x199, 14K)

what are you doing in this thread if you don't program at all?

circle jerk?

Carmack actually does this all the time news.ycombinator.com/item?id=16518726

I tried drawing how 20 years of professional programming has made me feel, but it ended up looking better than the IRL me

Attached: me.png (272x303, 25K)

>The people who have are "able to write simple versions to begin with" end up being either famous or millionaires or both.
no that just comes with experience

hello bjarne

Attached: 1549652324460.png (272x303, 27K)

section .data
text db "You are like a little baby!",10

section .text
global _start
_start:
mov rax, 1
mov rdi, 1
mov rsi, text
mov rdx, 14
syscall

mov rax, 60
mov rdi, 0
syscall

>20 years of professional programming
are you a millionaire yet?

No, I make the equivalent of $40k USD

I've recently had a look at some old code and I'm starting to see the value of proper comments

Attached: file.png (774x385, 92K)

Post your programmer fuel.

Attached: IMG_20190208_191115.jpg (3968x2976, 3.03M)

I've notice that also. Experienced programmers tend to 'build up' to the problem they want to solve, creating functions that take them inch by inch closer to the domain of the problem.
Inexperienced programmers tend to have some sort of 'anxiety' and try to solve the problem from the get go.

>#define inside a function
oh no no no

>he doesn't know what #defines are
OH NO NO NO NO

I can't find any of these html commands on w3schools :(

>not #undef-ing at the end of the scope
shitter

If I only need it in one function I usually define it right there
I should probably have undefined it after though

I was happy with this. Will try to improve it tomorrow.

Attached: parse2.png (686x583, 29K)

Of course not dingus. If a language is on w3schools to begin with then it is a baby-tier pleb language.

Attached: dingus.png (225x225, 7K)

dumb frogposter

yes, dingus:DDDD

now with angrey eyebrows because you said dingus again

Attached: dingus_angrier.png (500x500, 34K)

Actually I just realized that my code has an error (other than the code tags), who can tell what it is?

u are so bean:((((((

stupid frogposter

Why is this printing some hexadecimal instead of 100?

Attached: 1526123655967.png (378x337, 19K)

maybe some of your include called a std::hex before

any CUDA bros in here?

Attached: 300px-Nvidia_CUDA_Logo[1].jpg (300x182, 11K)

You're printing the address of the function Foo. In C/C++ like languages you must place () after the function name to call it:
std::cout

cout

Foo is the address of the function, you want Foo()

Thanks! i was sure i already tried that but apparently not.

What is encapsulation exactly?

You put your defines and macros (defined functions, like what you have done) at the top of the source file, or in the header file. This is for maintainability.

You use #ifdef and #ifndef to set defines and conditionally include different code.

The only time you should have a #define in a function is if it is wrapped in a conditional define.

(define (read-bencoding port)
(let ((ch (read-char port)))
(cond
((eof-object? ch) #f)
; :string text
((char-numeric? ch)
(unget-char port ch)
(read-bv port))
; ie
((eqv? ch #\i) (read-int port))
; l[value1][value2]e
((eqv? ch #\l) (read-list port))
; d[key1][value1][key2][value2]e
((eqv? ch #\d) (read-dict port))
(else (throw 'unexpected-char ch)))))

Just wrote this, still learning scheme. It works, I just read a .torrent file.

Attached: karen sicp 2.png (596x720, 436K)

got accepted in CS uni and will start it this semester but am so fucking afraid for being a 21 y/o. I don't know how to program and don't know much about computers either, but am in all honesty willing to learn all I can in this course. do you think I can get away with a decent career if I really try to learn and build a CV out of personal projects?

yes

Does Jow Forums know any good online resources to learn c?

thanks friend

Attached: _20181109_062218.jpg (500x296, 24K)

21 is not too old. 31+ means you're fucked.

do you think if we were to ask hiromoot very nicely he would upgrade the Jow Forums code tags and allow us to specify a language?

sure, only 5 dorra each time. いいdeal

Did you really just call Candice a baby tier pleb language?

screenshot your post so in 10 years you can lol at it

>21
Nigga I have tutored 50+ year olds who got divorced/fired.injured and had to get their shit together.

> 50+
If I had to start everything it took for me to learn, but I was 50 years old, I might just kill myself instead. Good on them though.

very interesting.
what kind of backgrounds did they have?

e.g. had they done any kind of technical work before?

Is there a single good software rendering library out there? I want to play around with retro graphic techniques, and terminal emulators are a bit too limiting, Id need free pixel level control.

Here we have something called codility, something like leetcode in US. You are given task and then you are assesed score. I got 68%, O(n^3) and it fails on bigger output here is assignment:


A non-empty array A consisting of N integers is given. The first covering prefix of array A is the smallest integer P such that 0≤P

>java
KYS

try SDL

please don't use the code tags to quote text

Something OOP developers think they understand.

>A non-empty array A consisting of N integers is given. The first covering prefix of array A is the smallest integer P such that 0≤P

Why