/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: c070fb918c9634418f496e6ad9595286b610646e1382965470.gif (241x360, 1016K)

Other urls found in this thread:

godbolt.org/z/5zKQ8R
godbolt.org/z/B6Ws4L
github.com/ethanhs/cce
cheats.rs/
github.com/unclebob/CC_SMC
harmful.cat-v.org/cat-v/
twitter.com/NSFWRedditGif

std::sort is faster than qsort

What is the best language for writing games?

I feel like a fucking brainlet whenever I try to go back to learning programming. I understand the classes and all that, I may even do some basic exercises I can find on the internet or in books but boy am I helpless when I actually want to design and write something real.
So I'm working on myself, I guess

sorting is based, i really should be grinding my stacks queues graphs and sorts

qsort would be just as fast if it were an inline function

>for old consoles, dos
assembly, C
>for modern bloatcore
any premade engine and whatever they script in there

>So I'm working on myself, I guess
great procrastination, you're surely on your way.
just start small m8, as small as you need to, and then very slowly iterate on it.
Also don't feel like classes and inheritance are the only way to do things.

NOO DELETE THIS

Attached: 1537771566378.png (1200x1400, 502K)

still working on terminal based blackjack. has been a fun little project but have been procrastinating a bit too much. i have a feeling the most difficult part is differentiating when ace is equal to 1 or 11 but well get there when we get there.

Attached: Capture.png (594x445, 11K)

I am, I just clipped it out of the sample I posted.

whats ur terminal

i guess i mispoke, i shouldve just said shell-based. thats just cmd that ive been testing in because its always more finnicky than unix based shells.

What's wrong with cat -v?

(define ((symbol-map) cmd key (val (list)))
(unless (symbol? key) (error "symbol-map only supports symbol keys"))
(match cmd
('get (eval key))
('set (eval (list 'define key val)))
(_ (error "neither get nor set sent to symbol-map"))))

Java and LWJGL2.

Any ASM fags here? What is clang trying to vomit here in the output?
godbolt.org/z/5zKQ8R

Attached: Screenshot from 2019-08-05 20-09-54.png (3646x1748, 530K)

[email protected]

You're looking at LLVM IR, not the x86_64 asm, here's the right output: godbolt.org/z/B6Ws4L

I'm a relatively experienced Java developer. I learned C and C++ in uni, but haven't used it in a professional setting. I want to build a little demo project in C++ for my resume.

To refresh some things, I might even like to follow along with some "make a game in C++" or whatever tutorial. However I have noticed most of these "learn [INSERT LANGUAGE]" tutorials are really bad. They focus on basic things like loops, but the structure of their projects are awful. The design patterns they use are bad. This is bad in my case, because the thing I'm interested in most at this point is specifically which design patterns I should think about differently than I would in Java.

So my question, can someone point me to a follow along C++ tutorial where the end result is actually an acceptable project with a solid structure, clean code and good design considerations?

Reading resources to be a data engineer, seems like the modern day backend developer

Games are not a good idea

I would pick something like a queue consumer in c++

Why are games a bad idea? I don't give a shit about games, but I thought it was a good idea because it would be a very clearcut way of thinking about objects and entities, which would make it easier for me to see differences with Java without getting to bogged down in project specific stuff.

What type of queue consumer would you recommend and why?

Keep in mind, my main goal is to be confronted with fundamental design differences between a Java project and a C++ project. So maybe it would be a good idea to create a non-OOP project. I wouldn't even know how to structure a non-OOP project of any meaningful size at this point.

>Features deferred to a later standard
>Contracts – a new study group (SG21) has been formed to work on a new proposal[91]
>Metaclasses[94]
NOOOOOOOOOOOOo

so what was wrong with contracts?

thought this was old news
are they finalizing the spec?

wonder how infuriated bjarne was, considering how hard he was wanking over them at the last cppcon

>developing web app in nim
>i havent hit recompile for like 40 minutes and wondered why things dont change

Attached: image.png (510x599, 391K)

Isn't contracts just glorified asserts?

More or less.

What C/C++ IDE if I'm using Windows and don't want to use VS?

how do I return `xxx' in the snippet below?
fun test(): Single {
someStuff() // Single
.subscribe(
{ n ->
val xxx = doSomething(n)
},
{ e -> println("yikes" }
)

// return Single.just(xxx) here
}

VS Code

>I accidentally 32MB
*What C/C++ IDE would you recommend

Yes, but I imagine they would be part of the signature of a function/method and not the definition.

Qt Creator

Attached: 1548072720735.png (1866x1944, 317K)

you don't, that's not how that works

>Metaclasses
Imagine the compile times

then how should I do it?

If(Val>21 && ace)val-=10;

async shit I guess

VS Code is not an IDE.

Everyone knows metaclasses weren't going to make C++20 though.
What's the expected target for it now though?

At this point c++ should just be a language you can use to specify a new language inside of then compile it and run as if was c++

A Lisp with C++ like primitives would be nice.

common lisp already did this 1994

MIPS is a cunt

Fuck MIPS

>github.com/ethanhs/cce exists
well fuck there goes another idea into the bin

What's the problem?

no u

It's much harder to intuit function when the language has such a minimal connection to written English. I have to look up every single line and keep forgetting the syntax and definitions shortly after I learn it. Pain in the ass.

Machine Learning. I need to get into this as quickly as possible so I can build a system to detect racists. This is getting out of hand.

lmao redditor

Build a system to detect frogposters instead and add them to an MD5 filter list.

The current systems can already detect white males.

this

fuck this linking bullshit god dammit

I designed my own MIPS processor in uni. To me MIPS is like spoken English compared to the actual wires and VHDL/Verilog modules.

>2019
>linking and header recompilation still fucked
you had one job bjarne

I will learn these things. Through sheer stubbornness if I must, but I will learn them.

>cmake .. works from ../build
>doesnt work from ../debug
wonderful

?

Just venting. Ignore me.

for large-scale/high-complexity games, C++. for small- to moderate-scale games, C# (avoid Unity, though; it's garbage). for weebshit visual novels (and literally nothing else), Python

C# and OpenTK is just this but better

Qt Creator. i also strongly recommend installing MSYS2 and using its package manager to install/update CMake, GCC/Clang, and whatever packages/libraries you want to use in your projects. Qt Creator has first-class support for CMake projects, and it's easy to set up build kits that use the MSYS2 environment's CMake/compilers/debuggers/libraries

you can literally do this

What are some fun, small C++ projects I can do to start learning?
The usual 100 clocks, calculators, etc. are always a bit snooze.

Attached: 1564920106500.jpg (1420x2300, 1.76M)

Rubik's cube solver

with an optional graphical interface

Preemptive multitasking x86-64 kernel.

cheats.rs/

Fuck off.

Rust board.

nice, when will other languages take example on the rust ecosystem

Games are not a good showcase to put on your resume since it doesn't tell the employer reading it on what skills are relevant to their business.

>Keep in mind, my main goal is to be confronted with fundamental design differences between a Java project and a C++ project
if you wanted that, you could just write a linux driver in C++. But again, not employable unless you want to get into embedded space.

A queue producer/consumer is good since you can showcase the performance of your queue producer/consumer in C++ by making use of the low level features you get like RAII and also make use of multithreading. Then have your solution with 100% test coverage and be deployed in a CI/CD environment, it will look very attractive in a resume.

??

Cope harder

>just write a linux driver in C++
That sounds highly complicated and time consuming. I think starting out with a smaller project is more realistic.

>unless you want to get into embedded space
I'm an EE by trade, so that sounds reasonable.

>with 100% test coverage
What testing frameworks are the industry standard for C++?

>CI/CD environment
I keep seeing this everywhere, but I still genuinely don't have an idea what it means.

Notepad++ and g++

embedded code is vastly different than normal backend services. So if did want to get into that, I would suggest working a microcontroller project.

Language and programming for games is almost irrelevant. You need graphics, arts assets... making game is more of an artists job than programmers. I used to love making toy game engines but since i realized that with 0 artistic skill they will never go anywhere i stopped. Much better to focus on something else

Games like Undertale, Risk of Rain, Minecraft and Factorio challenge your statement, they all have mediocre graphics, or even plain terrible and have all been successful.

I'm so I do have experience with microcontrollers.

>embedded code is vastly different than normal backend services.
In which ways?

The indie game industry is so extremely oversaturated, you would have to be a real brainlet to get into it at this point thinking you are going to be financially successful. Not even trying to be mean, that's just what it is.

I mean sure but I'm just providing a counter argument to this guy telling another guy that your game cannot take off without graphics but I agree that indie game market is just a coinflip.

Lisp is the most powerful programming language.

Are you saying that making shit like undertale doesnt require artistic skill? Let me assure you making something like that is far beyond me. Not programatically but artisticaly...

Learning PHP Hexagon architecture for a job interview coding test

At best low quality stuff like that requires *some practice* and not *artistic skill*. You could get away with basic theory and a little bit of practice. Ultimately it doesn't matter because if you really wanted to make something you wouldn't really worry about the assets but rather push your project to completion using placeholders all the way through and then either buy a cheap pack off itch.io or spend some hours doing them yourself afterwards once you knew what you need exactly.

waste of time, just offer oral

Fair enough

Whats the easiest type of language to make if you want to make your own language

a lisp
lexing and parsing are non-issues

github.com/unclebob/CC_SMC

A lisp, there are more lisp interpreters than lisp programmers out there.

Don't do this, it comes at the great cost of ending up with a Lisp.
Lisp syntax is DISGUSTING

haskell

what don't you like about lisp syntax

What am I doing wrong here?

C:\>\tcc\tcc.exe -I C:\SDL2\include -LC:\SDL2\lib\x86 -lSDL2 -run c:\test.c
In file included from c:/test.c:2:
In file included from C:/SDL2/include/SDL.h:32:
In file included from C:/SDL2/include/SDL_main.h:25:
In file included from C:/SDL2/include/SDL_stdinc.h:31:
In file included from C:/SDL2/include/SDL_config.h:26:
C:/SDL2/include/SDL_platform.h:188: error: declaration for parameter '__cdecl' but no such parameter

test.c is
#define SDL_MAIN_HANDLED
#include "SDL.h"

int main(int argc, char *argv[])
{
SDL_SetMainReady();
SDL_Init(SDL_INIT_VIDEO);

SDL_Quit();

return 0;
}

>What am I doing wrong here?
you're using tcc

you're using tcc instead of msvc

The fact is you can't inline functions generally in C because there are no generics.

harmful.cat-v.org/cat-v/