/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0144r0.pdf
youtube.com/playlist?list=PLDfKAXSi6kUapi0I8jCbQK3_TeIiDNEw2
stephendiehl.com/posts/production.html).
sourceof.net/
twitter.com/SFWRedditImages

First for C++ is garbage.

Stop shilling C, NSA

Ended up making changes to my restoration program, but I've given up for now.

You're missing the fact that
if (auto x = find_thing(); x != nullptr) { ... }
When you enter the if statement x still contains the result of find_thing().
It may seem silly but compilers will often not optimize away calls where there's no side effects. And where there are side effects you have to alter what's generally considered clear control flow into something less clear to keep the value around. Sorting out the 'init's first can be a hassle. And you might have to break up your single else if condition to an else if and a nested if, or break the else if chain and have the rest of the chain be contained in an else.

Now i don't regularly face these situations, but they're there and they're slightly annoying. Hence I say there's slightly more use for declarations in the if statement.
Fuck. Maybe we have the wrong syntax? Where's the proposal? This is just silly.
Yes.

I'm working on pushing this massive shit log out of my ass.

6th for "why aren't you using Ada, idiot."

This thread is garbage and you're all retards

It's way better than the old version if you could get rid of the sharp artifacts (those single bright/dark pixels) you have there.

Because Rust is the better Ada

I'm planning to implement a feature in C++ that will require making http requests.

In looking into socket programming, most of the results are "just use WinSock."

I want to make my source able to compile on both Windows and Linux. Is this possible for an individual? I would like to avoid making two different versions if possible.

Unkind

Because fuck Ada, I'm using Lisp.

>Fuck. Maybe we have the wrong syntax? Where's the proposal? This is just silly.

No, that's by design as far I remember. The proposal is here: open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0144r0.pdf

>C++ is garbage
why does it not need garbage collection then??

boost?

nth for C stands for CIA

Something about your post makes me not believe you.

The OS has to collect garbage C++ programs leave behind whenever they spontaneously segfault.

IS THERE A PROGRAMMING LANGUAGE WITH BUILT IN RACISM?

whateverth for fuck python

HolyC

Yes, the salt-n-pepper effect is a bit of a problem. Was trying to sort that out, but I'm done with this for now. May come back to it when I'm less busy.

Brainfuck with racial slurs instead of the usual syntax.

3.3 Should we also allow a non-declaration syntax without auto to replace tie() syntax?
For example:
{x,y,z} = f(); // same as: tie(x,y,z) = ...
{iter, success} = mymap.insert(value); // same as: tie(iter,success) = ...
We think the answer should be no. We know of no use cases where this is better than using std::tie, as
noted in the comments. It would also complicate the grammar because { is already permitted in this position to
begin a block, so we would need lookahead to disambiguate. (Using () parens is worse, because code like
(iter, success) = expression; already has a meaning and in some cases might compile today.)

Well shit. This is the crap that haunts C++ all the time. Some crappy incarnation of a feature already existed so they're gnawing the legs off a relatively good idea and make two half-assed ideas instead of 1.

I'm not gonna use it then.

A lot of times in shader programming I'll have to transform a 0-1 coordinate into another range. Is there a name for this? I searched "range transformation" and can't find anything.

For example:

Turn 0 - 1 into 1 - 0
Turn 0 - .5 - 1 into 0 - 1 - 0
Turn 0 - .7 - 1 into 0 - 1 - 1 and everything originally 0-.7 is linearly scaled

I've basically built my own function library at this point, but would like to see other people's work.

Pic unrelated.

Linear map.

It's common to say you're mapping a range.

Will x:Bind ever come to wpf?

I remember saying many times that C++ will never be a good language

Ah.
You can basically do destructuring assingments already with tie(), but the problem is that they have to be assignments, and some data types you can't assign to, or you can't create an uninitialized variable to assign to, so youre out of luck without the new syntax proposal.
Also
If the language had fucking macros you could implement all of these proposals inside a library and call it a day, but noooo

Mapping

What's your opinion on UWP?

Some of my favorite letters

My opinion is Kill la Kill is shit.

>If the language had fucking macros
More powerful macros?
C++ certainly has macros.

>but the problem is that they have to be assignments, and some data types you can't assign to, or you can't create an uninitialized variable to assign to
That wouldn't be a problem because you could say that it only works if all of the elements can be assigned, etc.
The problem is there's already a (,) operator

That guy certainly meant Lisp-style macros.

ewww

I need to write a sort function in racket, but have no clue over how to do it.

any help?

>Universal Windows Platform

captcha: veterinary artisan

is this many slashes normal in programing?

Only in shit languages, there's no reason to have that anymore.

Please don't bully

The slashes say "this macro continues on the next line".
This is a very long macro, so instead of putting it all on one line (making it extra impossible to read) they do slash newline everywhere.

Anyone has a cool playlist to either study or program or both?

I think this one's ok
youtube.com/playlist?list=PLDfKAXSi6kUapi0I8jCbQK3_TeIiDNEw2

They have some templates in there too just to make the code impossible to debug.

check out my silence mixtape

I like you.

captcha: john queensdale

FF4 OST
Chrono Trigger OST
The Well-Tempered Clavier

>debugging
Making errors is for amateurs

It is said that listening to classical music while studying makes you perform better in math. But that's probably just people observing people who listen to classical music being smart.

Try hardbass.

Well they certainly make errors if you look at the size of the patch notes.

goreshit

I don't like you

...

If you have never made an error, you've never made anything.

The problem is that sometimes you want to initialize an unassignable variable from a destructuring bind, but you cant get that with tie(). Tie already errors if you give it a variable that can't be assigned to

I want to making a language like C++, but
1) every type has an "uninitialized" value. This is necessary to allow move semantics without a complicated linear type system.
2) arbitrary terms in the language itself may appear at the type level. These are evaluated like C++ templates, just without the AST undecidability.
3) full fledged lisp style macros, which also have access to the language itself (or maybe an interpreted subset where memory is uncorruptable but doesnt need to be freed).
4) "dangerous" to program in: you get raw pointers, you can write meta code to determine memory layout of structs, you can generate inline assembly, maybe you even have access to the assembler itself?

I was going to recommend whatever C++'s equivalent to out is, but C++ doesn't have that:
if(int.TryParse("69", out var x)) { /* do stuff with x */}

I know but I can't concentrate on my office. My boss/dad talks a lot on the phone and he is loud.

God's prophet TERRY DAVIS warned of the CIA and we didn't listne

What, because "modern" languages "don't have" macros? It's called the preprocessor for a reason. You can just run it on any file. It "preprocesses" the file before compilation. Hence "preprocessor."

I've changed my mind

Please get along and love each other anons.

What's with all the fucking anime? What is the fucking relation on programming and anime whores?
Do you think Kernighan (to mention just one person) has a waifu?
Grow up.

wasn't talking about macros

i'm just here to post bestgirl

>What is the fucking relation on programming and anime whores?
Good programmers appreciate good anime.
That's the relation.

>Do you think Kernighan (to mention just one person) has a waifu?
I'm going to email him right now and tell him you are wondering about that.

Probably something like this with the new syntax:
`if (int result; sscanf("42", "%d", &result)) {}`

Macros are a language limitation

Gee, maybe because it's A FUCKING ANIME WEBSITE?
When will you fucking redditors shut up about this?
Stop wasting our time and precious thread bumps.

that's a boy

>Do you think Kernighan (to mention just one person) has a waifu?
Yes

...

...

Macros work on any language. The preprocessor works on any text file. It doesn't know what language your source code is in.

It's the PREprocessor. "PRE."

i wish

you proved my point

...

...

My language will have macros in the form of AST->AST functions that are run at compile time and are completely unrestricted.

>is F# worth it?
No, proceed directly to Haskell

This shit is going to be called a lot, is there any way I can improve it?

private static string checkSingleQuote (string name)
{
byte i = 0;

foreach (char c in name)
{
if (c == 39)
{
name = name.Insert(i, "'");
i++;
}

i++;
}

return name;
}

>best girl
>female

pick one

I don't think you understand. Macros are expanded BEFORE compile time. It's a PREprocessor.

>haaha le pol memes :'d

*looking at it from
>Haskell
But what about the .NET libraries? I thought Haskell was pretty library-poor (per stephendiehl.com/posts/production.html). What about the saner strings?

C++ is the MOST powerful language

It cannot self-terminate.

I'm not using the autistic C nomenclature. Compile time is compile time and run time is run time. Obviously AST transformations happen before type checking and code generation.

C macros are part of the standard, fairly sure that's the case in C++ too. m4 works on any file sure but you can't say they're not part of the language.

>C++ is the MOST language

>any language more powerful than assembly

for is about 5 times faster than a foreach loop

something like dis?

(define (qsort a)
(cond
((empty? a) empty)
(else (append (qsort (filter (lambda (y) (< y (car a))) (cdr a)))
(list (car a))
(qsort (filter (lambda (y) (>= y (car a))) (cdr a)))))))

Yes, you can improve this easily.

Use string.Replace(). It calls the appropriate C library and is very fast.

sourceof.net/

Haskell has great libraries, sure it doesn't have as many as .NET

>strings
Just use the overloaded strings extension, and pick a string type of choice (e.g. Text, ByteString)

>those parentheses
I came.

There are common ASM programming techniques that very very very few languages capture. For instance, infamous Duff's Device is in very ugly C a very common and normal ASM technique which no higher level language can achieve G*d bless The Machine and its Code

> if (c == 39)
Maybe use '"' for clarity?
Or, nevermind, that looks horrible.
But I'm not sure what you're intending here. You're checking for ' and inserting ' in its place, not sure that's what you're intending here.
Wow that's horrible. Has someone submitted a bug report to microshaft yet?
What's with these illogical problems?