/dpt/ ‐ Daily Programming Thread:

Programming Edition.
Previous Thread:

Attached: nene.png (900x506, 596K)

Other urls found in this thread:

gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Concepts.html#C_002b_002b-Concepts
trello.com/
youtu.be/sPhpelUfu8Q
twitter.com/SFWRedditImages

I wish I were an anime girl.

For experience being tentacle raped till your mind and anus break?

already exists

me too

Yes, and it has been derailed thanks to op

gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Concepts.html#C_002b_002b-Concepts
C++ concepts is getting axioms and forall.

That's gnushit

It's good but C++ is still shit

Have a bunch of nodes worldwide in a data center, rerouting data transfer to increase speed using something as simple as Dijkstra's algorithm. What is the best database to store all of the telemetry? Its a time series for each "flow" of packets alongside which data center they spawned from and other information about the packets

>The following keywords are reserved for concepts.

show me any proposal to the standard which uses these keywords

parens and braces
if one represents compound data types and the other represents compound statements, which should be which?

parens for scope
square brackets for lists
curlies are heresy.

what about indexing?

same as any other language.

I want paren free function application. Using square brackets for indexing as well as constructing lists creates an ambiguity.

>Using square brackets for indexing as well as constructing lists creates an ambiguity.
no it doesnt?

foo[bar]
is this constructing a list with one element and then passing it as an argument to foo, or is it indexing foo with bar

Or should it be determined from context?

i don't see a type declaration so it shouldn't be constructing.
looks to be indexing.

>what are temporaries

trash

maaaaaaaan every time I try to advance my project euler I get stuck on 1 question until I do it as efficiently as possible
I don't want to be ocd any more :(

I just recently started learning batch scripting and I wanted to ask if anyone here could give me advice?

Attached: 1527726058575.png (598x522, 400K)

Who's the bitch?

Microsoft literally made Powershell because batch scripting is so shitty.

But use unix instead

c++ masterrace

if a game is running at 30fps, why can't the values it uses just be halved when increasing to 60fps?
e.g. if in 30fps gravity = 1 and jumpForce = 20, so every frame the character's y = jumpForce -1, why is it when at 60fps gravity can't = 0.5 and jumpForce can't = 10?

... what?

__friendly __reminder __that __c __is __the __best __programming __language

Give proof or shut the fuck up.

C++ is the cutest race.

Attached: 1506583787504.jpg (1920x1080, 852K)

Looks like a 14 years old with big, juicy, succulent tits. Too bad she looks too young. If she was older, I would rigorously fuck her.

I'd rigorously fuck her regardless if she was 14 or not.
She's probably older than she looks though, you'd be surprised.

She still reminds me of a younger child.

Ok?

it separates the pahjeets from the actual programmers
>muh objects
>muh models
you get paid in incomparable speed for being good at what you do. whatever you used to post your shitty comment was at its core made in c.

>whatever you used to post your shitty comment was at its core made in c.
Firefox and Chrome are written in C++

C++ is still C at its core

Ok buddy.
The thing is though, FF and Chrome are written in C++ style C++, not C with classes.

Are you arguing against or for C++?

Yes

Oh my god there are intermixed tabs and spaces in this python script

agreed

Attached: file.png (567x594, 44K)

What c++ book is that?

Anybody grinding leetcode?

Why use std::array instead of a normal array?

if you need arrays within arrays, for example.

oh my god your retarded language cares about whitespace.

if you want value semantics for your array

Compile time computed arrays

constexpr auto your_array = []() {
std::array asdf{};
// fill asdf with shit
return asdf;
}();


You can't even value return a C array at all.

How do you guys get anything done? I'm trying to work on side projects before the fall semester but I feel like my whole apartment is a giant distraction. I usually end up playing vidya, jerking off, or taking depression naps. Should I start going to the library or a Starbucks?

Attached: 1529358034076.jpg (743x729, 154K)

help, anyone got a clue as to what is going on here? or do I have to go in and remove everything makeinfo/texinfo related from the makefiles?

Attached: unknown.png (800x600, 87K)

How does having a programming job affect your sparetime programming projects?

Very effectively. To the point where side projects don't exist at all.

The good news is you'll never do it "as efficiently as possible", because you can always improve, so shouldn't make that your goal. A good rule of thumb is just to make sure your program is < 1 minute (maybe

what are you supposed to program after you learn a programming language

Attached: Fib2sWc.png (282x300, 78K)

Haskell

Any advice for programming udp networking? Packets are suffering.

a programming language

this

Whatever problem you wanna solve. You hit 'em problems daily not knowing that they can be solved programmatically. Just keep an open eye for them, user, and help make the world a better place.

Is there anyone here works at a fairly medium size group like 30 developers.

What is your workflow? like how do use gitlab, jenkins,kubernetes,docker like those thing for automation? also redundancy and backups?

Ask ahead. Batch-scripting is hellish, though. Avoid doing anything complex with it. Case in point:

(

::if you put a label before a closing parenthesis, it has succeed a comment like this one, otherwise it wont parse correctly
:somelabel
)

It's shit.

test

Branches
Branches everywhere

I'm trying not to let rust beat me, but fuck
why is it so hard for me to find an idiomatic way to accept a string into a method on a struct, and store that string as a field in the struct?
specifically I'm trying to read content from a file in one function, pass the parsed line to another function where the string(s) will be used to set certain struct fields (as &str)... and basically I'm at the point where no matter what I do I cannot get the borrow checker to be happy, I am currently always running into an issue with some variable in this flow not having a long enough lifetime.
Should I drop the use of &str for struct fields and just use String?
I cannot seem to find anything in the documentation that indicates one way over the other, in fact most of the time the documentation is pretty lacking imo, and google searching doesn't help since results from a year ago are basically outdated because of the changes to the language
How the fuck does anyone write anything in this? It seems completely immature as far as languages go, I thought it was further along than this?

is there a tool with which i can collaboratively organize ideas into cards and tag them?

oops meant to put that in sqt

trello.com/

So many super cool techniques in this library
youtu.be/sPhpelUfu8Q
Probably will rebuild my cpp persistent lisp cloney library to include some

Attached: 08b15a9fc030064dbaa6989e7e009164.jpg (962x1372, 203K)

>Should I drop the use of &str for struct fields and just use String?
Yes, you smoothbrain, if the struct owns a string it should be a String, or an Rc or whatever if you want to get fancy

That looks interesting, thanks for sharing you stinky weeb.

I am trying to learn haskell. I know /what/ it's doing, I just don't know why it's doing it:

arr = [2, 5, 1, 3, 4]

bubbleSort :: (Ord a) => [a] -> [a]
bubbleSort [] = []
bubbleSort [x] = [x]
bubbleSort (x:y:xs) = if sorted thisSort then thisSort else bubbleSort thisSort
where thisSort = (min x y) : bubbleSort((max x y):xs)

sorted :: (Ord a) => [a] -> Bool
sorted [] = True
sorted [x] = True
sorted (x:y:xs) = if x

List syntax is just syntactic sugar for linked lists. You can create a similar type yourself, and it compiles to more or less the same thing:

data List a = Link a (List a) | Empty

sorted Empty = True
sorted (Link x Empty) = True
sorted (Link x (Link y (Link xs))) = ...

thanks user. And the (a:b:c) syntax is just an assumption made by the language, where it just knows that each variable is one element, and the one at the end is just "everything else?"

The mutable mode on r-values with only 1 owner with ref counting is so awesome

Two things:
1. The colon operator is right-associative, so (a:b:c) parses as (a:(b:c)), kind of like how (a+b+c) parses as ((a+b)+c)
2. The left and right arguments of the colon operator have different types. The right argument is a list and the left argument is an element of that list.
The compiler knows all this, so list pattern syntax gets to be much lighter-weight than it would be otherwise

>1:50
>blue eyed
>undo history

Attached: 1527040408757.png (729x638, 154K)

Holy shit suddenly it all makes sense, thanks

Owning would imply the struct could/would manipulate said string, what if it's only the field that needs to be updated meaning I could very well use an immutable reference to a string since I'm never planning to actually changed the string assigned to the field?
I am still forced into String?

You can use a Box to express "a chunk of string data that is owned but will not have its contents changed"
If it might be used in multiple places you can use an Rc or an Arc instead

There's a website I'd like to scrape photos off of, but they store them in slices so you cant just yank the whole image off in one go.
They USED to store them in a simple /id/slice_1 /id/slice_2 format so it was trivial to just yank them and stitch, but now they're stored
/slices/ABSc697721f4524 /slices/ABS23da2898fedf etc
The ABS is consistent between photosets no matter what, and I tried tracing the DOM when loading the full image and it just calls a php script with the main photo ID.
Are these database UIDs or something? i.e. No chance or being able to lazily scrape them again, short of using something like phantomJS?

Why is flutter/dart such an ugly language?

I'm working on maintaining a bunch of Crystal libraries. I really want the ecosystem to grow.

Because:
physUpdateMS( 1000 / 30 );
Does not always produce the same results as
physUpdateMS( 1000 / 60 );
physUpdateMS( 1000 / 60 );
This is often due to floating point error accumulation occurring twice as much in the latter example. Normalization (correction / rounding) of said float operations would have to be performed carefully per each iteration to reduce the

Furthermore, polling the input stream presents a problem: Consider "move forward" input event happens thus:

toggleInput( MOVE_FORWARD );
physUpdateMS( 1000 / 30 );
Now consider if the sampling were increased to 60 FPS; There are two different outcomes:
// input event fires prior to the two physics ticks
toggleInput( MOVE_FORWARD );
physUpdateMS( 1000 / 60 );
physUpdateMS( 1000 / 60 );


// input event fires between the two physics ticks
physUpdateMS( 1000 / 60 );
toggleInput( MOVE_FORWARD );
physUpdateMS( 1000 / 60 );


Even if you had carefully programmed the logic system to avoid FPU error propagation, the timing of the higher res (60fps) input events would be irreconcilable with a lower res (30fps) system. Two networked systems (or a demo recorded / played back) would quickly desynchronize unless the input polling rate was artificially set to the lowest common denominator (30fps).

This really doesn't matter though, because we just code our logic loop to be fixed at 30fps or even 10fps, and use client side prediction to interpolate and render as many frames as you want between the physics steps; Then rubber band back into the server's "authoritative" snapshot of history when the prediction doesn't match reality.... and plebs are none the wiser.

Attached: 1474812343620.png (506x662, 103K)

s/to reduce the/./

I got a question out of curiosity.

I mostly use Linux now, so this is no longer a issue but:
On windows how do you compile C code? I know MinGW and Cygwin exist but both seem to be like compatibility layers for windows. So how do people compile code to work across windows machines?

you'll have to rewrite your question in hindi if you want to ask people who program on windows

Oh you're right my bad

मुझे जिज्ञासा से एक सवाल मिला।
मैं ज्यादातर लिनक्स का उपयोग करता हूं, इसलिए यह अब कोई मुद्दा नहीं है लेकिन:
विंडोज़ पर आप सी कोड कैसे संकलित करते हैं? मुझे पता है कि मिनजीडब्ल्यू और सिग्विन मौजूद हैं लेकिन दोनों खिड़कियों के लिए संगतता परतों की तरह लगते हैं। तो लोग विंडोज मशीनों में काम करने के लिए कोड कैसे संकलित करते हैं?

You use a compiler. You realise windows has a C compiler just like linux does?

Attached: Capture.png (642x248, 19K)

wot.jpg
It does? Why the fuck is MinGW and Cygwin even branded for that purpose? Is the default compiler shit?

The microshaft compiler is shit but you can just use gcc. MinGW gives access to linux-only libraries like dirent or whatever. Also gives you access to other linux tools and utilities like a package manager and such, it's essentially a linux terminal env running on windows.

No you silly goat.
It's a GNU environment running on Windows.

>can't return arrays in C

what the fuck
I'm too brainlet to deal with this shit

pointers everywhere
just deal with it

we told you c was shit
have fun manually doing bounds checking as well.

>not using a sentinel
sasuga pajeet