/dpt/ - Daily Programming Thread

What after you working on, Jow Forums?
Old:

Attached: Cirno_Kirisame_Marisa_Learning_Programming_CPP.png (800x720, 263K)

Other urls found in this thread:

reddit.com/r/cpp/comments/9vwvbz/2018_san_diego_iso_c_committee_trip_report_ranges/
twitter.com/SFWRedditVideos

In C++20, this will be valid syntax.
foo::bar{.frob=wobble}

Lazarus/Delphi
>not used by pajeets
>not embraced by Bay Area leftists
A truly red-pilled language

And there's nothing wrong with that

Or maybe it's just too shit even for them.

Reminder that Cirno's a dumb baka

Programming in C++ should be ILLEGAL desu

Attached: 1537985908896.png (1075x1518, 1.76M)

God I wish I was that book

But... why?

Attached: 1528665985184.gif (350x350, 881K)

and its beautiful. click here for 20 reasons why

Cool.

i wish i was that girl
dumb frogposter

2 new features
#1 designated initializers that let you assign struct members by name. They've been in C for a long time but they're now in C++ and weaksauce
#2 class instances as template parameters. So you can pass structs to templates just as you can to regular functions. g++ already has this feature, although it doesn't parse bare brace init lists properly yet

char a[10];
a[10] = 0;
In C18, this compiles without any errors because compile-time bounds checking is a non-standard compiler extension and needs to be enabled explicitly.

Wanna see the C++17 alternative?

Based C++17 version poster

No

Of course that's valid syntax. Nobody is crazy/retarded to try and cram semantic analysis into a fucking parser.

>compiling is parsing
Based retard

oh no no no
struct Foo
{
Foo() = delete;
};

Foo bar{};

>this shit compiles

I don't think it's even possible.

Parsing is a step of compiling, and is the part that deals with syntax specifically.
When you talk about valid syntax, you're specifically talking about what the parser is going to accept, before it reaches semantic analysis later.

You'd have to make a constexpr instance of your class type as a static or global variable, then pass a const reference to it.

Just because he replied to a post about syntax doesn't mean he thought his own post was related to syntax

What are the practical differences between C# and Java in terms of potential? For fags who programmed both.

AFAIK C# has goto and Java has more different GC options (CMS, G1, ZGC)

>If you want a systems programming language, you by definition can't tolerate a GC.
No point arguing about labels. The reminder obviously wasn't meant for people who agree with you. I'm using Nim for a high-performance game engine, which falls under "systems programming" as far as most people are concerned, and Nim's GC is causing me no problems. I use it in a limited capacity, for convenience.

>If you were okay with a GC, you were looking for a scripting language
Now that's simply retarded. Also, see above.

Clang warns you by default. GCC doesn't even with -Wall or -Warray-bounds because GCC is shit. These warnings should be part of the language as errors, because it's retarded to know both the array length and index but do nothing about it.

okay, so I have this c++ code I compiled and ran on windows, everything worked just fine. But the same code I compiled and run on linux and it gives me a seg fault, wtf? I used gcc on both.

Just learning bash scripting atm, I'm a beginner though, we're learning it at my "trade" web dev school, it's pretty nice, any bash tricks any of you want to share with me? here are mines:

# creating multiple directories and subdirectory trees
mkdir -p superdirectory1 superdierctory2/{branches,tags/{subdir1,subdir2/{subsubdir1}},trunk/{cgi-bin,htdocs,scripts}} superdirectory3

# Replacing text in a file and saving it as another file
sed 's/hello/world/g' input.txt > output.txt

Attached: 1533413115267.gif (500x378, 387K)

Maybe the programmer WANTS to write to the memory at the end of the array.

That just C++ for you. Unreliable and shit.

Alright boys, I'm gonna do it, I'm going to learn how to program.

And I'm going to learn C first.

And here's why that's a good thing... wait, named initializers is actually a good thing.

you a gay

thanks, will need to read up on c++ some more

different underlying frameworks running the binaries JVM vs .NET, though i believe .net can actually compile to native libraries
Java is designed to be 100% object oriented, this is... painful sometimes, especially when architecting larger projects.

Otherwise there's not much difference afaik

Attached: 1541452399829.jpg (600x600, 235K)

Same optimization level? Any external libs?

Run it under address sanitizer and UB sanitizer, then fix your bug.

Un/implementation defined behaviour strikes again

Dereferencing a bad pointer is ub. It's not guaranteed to give you a seg fault. Post the code.

girls can't be gay

well, can't argue that... can girls (male) be gay though?

I've been working on a bytecode interpreter for a relational language.
I'm trying to keep the entire project under 8000 non-comment lines.
The interpreter, including all built-ins and runtime miscellanea, should be at most 3000 of those.

If you're interested in C++20, the major changes are here.
reddit.com/r/cpp/comments/9vwvbz/2018_san_diego_iso_c_committee_trip_report_ranges/

you can't simultaneously be male and girl

Attached: it's a trap.png (1275x677, 873K)

>September 2018 modules meeting in Bellevue, Washington where we reached a consensus on a design for modules for C++20.
hallefuckinglujah. I was 90% sure they'd punt again.

oh shit thanks!

checkmate atheisms

Attached: 1526090484010.jpg (360x360, 16K)

>constexpr try and catch.
>constexpr dynamic_cast and typeid.
what is this sorcery?

Anything that makes C++ good?

constexpr try/catch just means you can use try/catch in constexpr functions. They still terminate compilation when executed at compile time no matter what, so it's kinda lame.
Constexpr dynamic_cast and typeid complement constexpr virtual functions. It basically means constexpr objects can do all the same things regular objects can.

Modules, primarily.

Threadly reminder: if you can tolerate/benefit from a soft real-time GC, Nim is actually a very good C++ alternative. It's certainly more feature-rich and coherent.

Attached: nim-logo2.png (462x187, 73K)

So D 2.0? No fucking thanks.
C++ is shit, by the way.

I'm wanting to create an app. I'm going to utilise a kanban board of issues to work through.

What tickets aren't obvious that I should have and work on?

Jow Forums is the task I've been given actually possible? I feel like I'm misinterpreting the task somehow but i don't know.

Basically, I have to create one method with this signature, and sort the given list into descending order without using iteration or loops, it's meant to be completely recursive. Also no new methods.

Surely I need some sort of iterating in order to check through the list to see it's sorted at least? In fact I literally cannot imagine doing anything without using a loop. Sure we've been taught some sorting using recursion but they all involve some sort of for loop at the least..

Attached: reverselist.png (613x39, 2K)

If you're looking for a systems programming language, you by definition cannot benefit from a GC

Merge sort

Anything you do with a loop can be trivially converted to recursion.
Is this the LinkedList from the standard library or something you've defined yourself?

It's definitely possible. I'll give you a hint:
Recurse to the end of the list, and work your way back up.

He's reversing it, not sorting it.

am I wrong or is this just reversing a list?

it's from the java library

See

He said "sort the list into descending order." The function name had me believe he meant reverse, though...

Try Python, it might be more your speed

That's what I thought it was at first, you might be right.

That was my first thought though I was put off because most implementations I've looked at use other methods or while loops. Though maybe I can just use the linkedlist functions to get past that, I'll try it

Graded coeffectful modal and contextual linearly ordered guardedly recursive dependent types with separation logic and types for inline assembly blocks will save systems programming
>tfw accidentally saved this on a shared drive

>can't address the argument
>resorts to more weak bait

Pick your ride, /dpt/.

Attached: ccpp.jpg (517x557, 95K)

>if you can tolerate/benefit from a soft real-time GC, Nim is actually a very good C++ alternative

>if you can benefit form something that has no applicable use for anything you would want C++ for, it's a good C++ alternative

Should I take the Clojure pill? I've been getting curious about it lately.
I already know Java and Scala so I wouldn't gain much from it since it's yet another JVM language. But since lisp shit is apparently so """mind bending""" maybe I would?

We can be proud of you, that is, if you at least study it for a month

First time posting on Jow Forums, just wondering if any of you think codeacademy is bullshit, as that's where I'm getting my first lessons. If it is, how did you guys get your start?

Learn a better Lisp dialect like a Scheme. Clojure isn't a good Lisp.

"""programming""" with a GC isn't programming.

Micromanaging memory is not programming either.

I wonder what RAII types and zero cost abstractions are?

YouTube and pirated books from the Internet

Already refuted (), and I'm 95% sure you're the same retard who posted it the other two times.

That post refutes nothing

RAII still requires you to be conscious about object lifetimes, user. If optimal performance is not relevant to the task at hand, there's no point burdening yourself with such concerns.

>can't address the argument
>resorts to more weak bait

honestly if you're """programming""" on a computer you're basically a typist

Needs more dakka boss

>RAII still requires you to be conscious about object lifetimes, user.
As you should be. Otherwise you're not programming.

I'm aware of stack register and how to work with in assembly but is there actually any difference of stack from the rest of the RAM from the CPU side? Is it cached better or something?

Not really. It's all the same hardware.

hurr durr

No, the instructions related to the call stack don't care where it actually is nor whether it's even contiguous. The OS decides that stuff.

Please kindly refrain from using youtube clickbait capitalisation in coments or better yet, at all.

A fitting noise coming from you.

he's right you retard. you always care about lifetimes. that the computer does the management for you doesn't mean you can just create shit and forget about it.
but I guess now I know why we have shit like browser based text editors that eat gigabytes of memory to edit a 40byte file. it's because of bad pseudo devs like you

Your link does not work :(

I'm seeing a lot of buzzwords in this post user. Got something to tell us?

Attached: 1539202523240.jpg (850x1190, 227K)

well, you don't need to go through expensive memory allocation to create shit on the stack as "stack allocation" is literally just subtracting from a register. so it's faster creating stack objects. ofc their lifetimes are very different to heap allocated objects

bloated programs are usually the result of way too many layers of abstraction not one bad programmer making bad choices

>and Nim's GC is causing me no problems
yet. GCs tend to cause problems once the project is 90% done and you fight curios performance regressions. then you realize it's the GC and you're fucked. but you ship it anyway because 90% is done.
your engine might be fine for now but only because you test it with trivial toy programs. prepare for a big surprise once (if) you come to implement a more complex game with it.

you have a bug in your code that doesn't get triggered on windows by sheer luck

if I go full retard I prefer crystal to nim

>it's meant to be completely recursive
what? traversing a list is not a fucking inherently recursive problem? lol what pajeet school do you go to?

>GCs tend to cause problems once the project is 90% done and you fight curios performance regressions
I simply don't use GC'd objects in the engine itself.

>your engine might be fine for now but only because you test it with trivial toy programs
It's fine, and will remain fine, because I actually know what I'm doing. Are you sure your post isn't just based on projection?

>i'm not responsible for my stupid actions
kek millennial based development

>circle jerk about programming languages non-stop

what have you actually made? a website? is it live? you got an app in the app store? do people use your software? are you working on a game?

the best way to learn programming is to work on personal projects

Attached: 1541800369091s.jpg (250x250, 4K)