/dpt/ - Daily Programming Thread

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

Attached: 1484152575123.jpg (940x822, 675K)

Other urls found in this thread:

pastebin.com/Sy6rruSQ
en.cppreference.com/w/cpp/container/vector
kitlang.org/
twitter.com/NSFWRedditGif

Install Shen

>his language of choice doesn't have pattern matching

Attached: 1527701541879.png (3084x2568, 188K)

why did hiroyuki add this crap to the page source AGAIN? at least it isn't making http calls to suspicious ukranian domains this time
pastebin.com/Sy6rruSQ

wrist pain from constant laptop use
how do i fix this

stop using it.
invest in a proper keyboard and mouse.

They’re called regular expressions you dumb zoomer

Bumping for new thread

Thoughts? It's the best web framework out there.

Attached: spring.png (800x260, 12K)

you're basically doing all the work for it.
minimalist logos are really easy to randomly generate.

Can anyone Javapill me on lambda expressions real quicc?

And why tf we need them? Java is Hasklel now?

I usin them for cs project but it dont make no sense nobody

Personaly I really hate it.

>Java shit

Npcs.

consumerism is so copy paste that you can just use a piece of software for "design"

Not sure if bait

You do not need lambdas. However, what Java needed were higher order functions, e.g. map, filter, fold. Subsequently, Java also has a demand for lambdas because you dont want to define a top level function for every pity shit you do.

Why is C++ so gay with dynamic sized arrays
>loop through elements and display them rather nicely
>I get garbage output after element 4

Reeee

Attached: 0BA3C5C2-8160-456F-8993-2E7CE0D07440.jpg (600x446, 56K)

Delet dis

Attached: 738EF0E8-E5D0-41AA-A100-F93A60F3DB58.jpg (708x480, 44K)

c++ is not the gay here, you are. Learn to C++ newb

How do you loop through elements?

a standard for loop

dumb frogposter

Delet

What are some advantages to C++ over other popular languages of today?

Attached: 966D7C31-E14B-4B32-81C0-5B3A6CBD39DF.gif (336x468, 189K)

how exactly
show the code

stupid frogposter
there's no reason not to use Haskell instead

RAII
zero cost abstractions
multi paradigm
still evolving
template meta programming
typesystem
portable
can be as fast as you want it to be

post code

lots of data structures, lots of crazy generic stuff, look up stepanov's work

Start using iterators you mong.

>What are some advantages to C++ over other popular languages of today?
it's popular and you won't have much trouble finding a job.
that's about it.

>what is iterator invalidation

>>loop through elements and display them rather nicely
>>I get garbage output after element 4

What is his task specification?
He is not doing any inserts/removes or any of that sort.

he should just use a auto for: loop which is more expressive and less error prone anyway

>almost 30 years old
>no career
>know next to nothing about programming, decent entry level computer knowledge
>been bar tending the last 8 years going nowhere
>considering trying to learn how to code to get a job/career in that field

i feel like the way things are going coding will be a useful skill at least to get me a job. but is it too late for me Jow Forums?

Attached: aZq3Fr4A.jpg (400x400, 32K)

Ditch standard dynamic arrays.
Use STL Vector or some other standard container.
en.cppreference.com/w/cpp/container/vector

Sooner you start using them, the better time you will have.

yes, also programming is a shit job

And what is auto but an iterator?

>decide to port some software to obscure OS with posix offered as an emulation layer
>oh first i will need to port x
>oh first i will need to port y
>oh first i will need to port z
>oh shit first i will need to port a c99 compiler
>ansi c compiler doesn't even work properly
i really hate software

this
no advantage over being a hobby programmer
sure is great having my boss interrupt me every 15 minutes and assign me to inane tasks that he'll forget about and wonder why I spent hours working on because he doesn't understand the code base

Just go web dev.
I'm 22 at mid level position making fine $$.
Haven't touched web deving till 6 months ago.

Attached: the joy of programming.jpg (496x1122, 204K)

I don't think you know what you're talking about.

only 3 days until cpp con!

Attached: .jpg (618x950, 377K)

Not too late

But is it a shit job in comparison to being a bartender?
I'm still in uni so I don't have any experience, but I'm thinking even being an app developer is better than 90% of the jobs out there, no matter how bad it is.

It is, being a programmer is one of the best jobs out there
Programmers are simply entitled whiny narcissists.
As long as you don't treat programming like you are some artist, and the users should feel honored for being allowed to use a program written by the Great You, you'll be fine

>You do not need lambdas
then why tf we gotta use them shits in my software dev class to reinvent google?

Why tf all the inheritance and anonymous class bullshit in Jabba so gotdamn confusing compared to the rest of the language?

its as bad as trying to do OOP in Python where you know yet clear that the lang wasnt designed with it in brain so it feel an look garbo and bolted on.

Gud b8. If not bait, then you really don't have a fucking clue do you?

Nice bait, but you have to be more subtle, not as clumsy or random with this blaster bait.

Java is a confusing language to start with.
The point of inheritance is that you can handle classes that share properties in the same way, using the same methods.
Don't use it to avoid code reuse, use composition for that instead. Only for dealing with different classes & types of objects in the same way.

>modern garbage collector
>incredibly low latency, and tiny overheads
>optional, if you really must disable in a performance critical area of your code and manually define lifetimes
>uses strong empirical observations on memory use to guide optimization (generational GC)
>profiler based tuning, much better theoretical performance than naive methods (see below)


>c++ 1970's RAII
>just pretend allocation isn't happening
>spam tiny allocations everywhere for no reason
>guaranteed copy elision not a thing until fucking 2017, move semantics didn't even exist for most of the languages history LOL
>mangle your code into a weird C with classes abomination if you want to control and reason about your memory use, and can't use the STL because half of its constructs will spam new constantly, or eat up memory in greedy allocations to try and avoid the inherent problems with naive implementation (no profiler!)

thoughts

Attached: yes im just restarting that one argument from the previous thread .png (507x674, 239K)

Nim > Sepples
expect to see Nim blow up as soon as it hits 1.0.

*shitting noises*

>OOP in Python where you know yet clear that the lang wasnt designed with it in brain so it feel an look garbo and bolted on.
That and Java adpating lambdas and functional shit is just one language dickriding a meme started in another language where it actually made sense because it was the foundation of the original language.

For OOP it was Python dickriding Java adn C++ being barfed out from C, for FP it's Java dickriding Haskell. it's how good languages go to shit.

>spam tiny allocations everywhere for no reason
for UE4 substitute "fucking massive allocations"

the biggest thing people overlook is that a lot of key API's are written in C++ and are not ported over but rather just get some lazy ass wrapper. So do you really want to set out to do a project with X and then end up having to write a big chunk of project in C++ anyway?

I bet you call Linux "GNU/Linux" too

depends where you live. the market is pretty tight in some places and they are giving out jobs like candy in others.

you mean C, relatively few libraries are written in sepples

not to mention shared_ptr (reference counted trash) is litteraly 10x slower than decade old GC's lolol

Attached: .jpg (1800x2600, 308K)

This pretty much
I was applying for a Java position, and the only thing they wanted to know if I can write a for cycle, then taught me the rest. But when I moved to a different city they kept grilling my ass during the interview even after years of experience

JavaScript rocks!

no makefile, no use

based

>lincucks
no use

no comment cause I have no deep knowledge of compiler versions, dependencies, language compatibility, blah, blah, blah. I recommend knowing both just because general knowledge of one helps with writing in the other.

nobody knows C++

Very good, just get in take specifications from clients if you really could listen persons and coding some UI.

I do.

>>guaranteed copy elision not a thing until fucking 2017, move semantics didn't even exist for most of the languages history LOL
We're in 2018, so I'm not sure what your point is exactly.
Are you trying to pretend we didn't get those things or something?

>Why tf all the inheritance and anonymous class bullshit in Jabba so gotdamn confusing compared to the rest of the language?
because you're retarded
java's OOP model is perfectly simple and lambdas slip elegantly into it

i keep seeing posts like this. am i having a stroke or is there really some faggot who sounds like a bot?

you use c++17 on production?

Nice meme.
I do.

Yes.

poser hobbiest or just lying
90% chance im correct

I'm not posing and I am a hobbyist.
If you're argument is that no company uses C++17, then chances are you're going to be even more hard pressed to find companies that use D, Go, etc which are what your post seem to be shilling for.

Go is used in industry more than C++17, not to mention Java which has a bunch of insanely fast GC's

don't use your thumb to work the touchpad

it's impossible to know more than 10% of C++ at any time

prove it

According to memes*

you do not seem particularly bright

K nice argument, you got me.

lol,

Attached: nQueensAllocatorPerformance.png (1150x848, 17K)

lol

>> NaN === NaN
false
>> NaN == NaN
false
>> typeof NaN
"number"

that's IEEE floating point behaviour though

pick a better example

its literally the same in any language
#include
#include

int main() {
printf("%d", NAN == NAN);
}

>0

Shared pointers are shit but this chart really doesn't mean anything without the code used to come to those results.

>2018.
>he still programs in C.

Kit is a programming language designed for creating concise, high performance cross-platform applications. Kit compiles to C, so it’s highly portable; it can be used in addition to or as an alternative to C, and was designed with game development in mind.

kitlang.org/

Attached: logo-128.png (384x128, 24K)

Why would I ever use this over Rust

sounds interesting, but aren't C/C++ compilers slow as hell? The language I currently use takes less than a minute to compile my 70 file project but I've heard of people having to wait minutes or even hours for their C projects to compile
also why does it have semicolons in 2018

>Kit compiles to C

So it has to "compile" to C before it actually compiles? Sound dumb and gay.

C projects compile fast. C++ compiles slowly because of the highly contextual grammar and endless template hacks.

Semicolons are good, you're a nigger

I'm always stuck on ideas. Feels like everything has already been done except AI type shit. There's no tools I really need for anything except making existing stuff less shit. But I don't know how to do that without some kind of extension system in place.

>but aren't C/C++ compilers slow as hell?
C compilers aren't. C++ compilers are.
>having to wait minutes or even hours for their C projects to compile
Only very large projects would take that long to compile in C. This is often exacerbated by shitty build systems though.
I've started to use Meson + Ninja for building my C programs, and it's significantly faster.

Compilation to C as an intermediary target is common. Chicken Scheme and (I think?) Mom do it. Even C++ originally did it with Cfront.

it's using C as an intermediate representation language like Clang compiles C to LLVM IR or like emscripten compiles C++ to javascript or like GCC compiles C to Assembly. programming language to programming language compilers are often called transpilers

>Semicolons are good, you're a nigger
compulsory semicolons are completely pointless

Looking over the feature list and it doesn't seem to over anything over C++ at all

Meanwhile in JavaScript
(function()
{
return
{
1 : 2
}
})()
=> undefined