/dpt/ - Daily Programming Thread

Previous thread: What are you working on, Sup Forums?

Other urls found in this thread:

open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4681.pdf
twitter.com/SFWRedditVideos

first for my toy lang

Wow lad, someone taught you that 1337 haxxor trick. How will others ever recover.

The 1337 haxxor trick of pointing out that you're a schizo?

>lol ur schizo
Come on, lad. At least be creative, you are so much predictable at this point.

I'm trying to understand the rationale for the oddity of the C++ modules TS: open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4681.pdf

The two primary goals of C++ modules are: to enable more efficient incremental builds by precompiling imports and avoiding the noncommutative order-dependence of #include files containing macros; and to provide a better means for separating public interfaces from private implementation details.

So, why can't this be done in a more minimal way, such as this "Modules Lite" strawman proposal here?

> Support non-interfering, precompilable headers by introducing a new "#import " directive, which works just like "#include " except that macros defined within the imported header are not lexically visible inside the bodies of subsequently #imported files.

>Inside a namespace or a class or struct inside a namespace, allow "exported:" and a new "internal:" access specifier to limit the visibility of subsequent symbols to the current namespace, its child namespaces, and declared friends of the current namespace.

>Allow "friend" declarations inside a namespace, exposing this namespace's "internal:" symbols to the declared friends.

>Extend "friend" declarations to support namespaces in addition to classes and structs.

Does this kind of approach fail to accomplish the goal of modules in some fundamental way? It seems like it would be more useful in separating exported symbols from internal detail at a more granular level than "everything in this class, struct, or namespace"; it would preserve most of the functionality of macros; and it would follow existing precedent more closely.

>everyone who shits on rust is the same person!
>look, i have a proof! all posts with this anti-rust pic shit on rust! coincidence? i think not!
>the different posters pointing out the absurdity of my conclusion are also the same person!
>w-what's that? screencap implies they're different people?
>h-haha, s-someone taught you 1337 haxx
This is what mental illness looks like.

Reposting from last thread. For some reason this simple program keeps leaking memory. About 400kb a second for me. Also, when I replace join with detach it segfaults. I can't find any useful info about this and I'm beginning to think std::thread is just full of bugs.

#include

void foo(){
//literally nothing
}

int main(){

while(true){
std::thread t(foo);
t.join();
}

return 0;
}

Timely reminder that C is the language of Lain.

you mean lisp

Actually, you literally are the same person - the "mutible mutable reference" autist. Your line of "logic", your post pattern, timing, issues with Rust are so damn retarded that even it's too predictable, even for echo chambers like Sup Forums

I can't reproduce this. Are you sure your program does not include a profiler, address sanitizer or such thing? The memory increase may come from this.

_CRTDBG_DELAY_FREE_MEM_DF may be on for some reason

meanwhile
auto min(X,Y)(X x, Y y)
{
auto res = (x > y) ? y : x;
return res;
}

>He didn't return (x > y ) ? y : x
laughing whores.jpg

How does /dpt/ feel about Nene?

Shit anime

What project can I work on that would show I can handle an enterprise dev environment?

it's late, but yeah, even better.

Anything with a sprawling nonsensical architecture running in different but overly coupled contexts

Inspiration to us all.
She learned a difficult language in a difficult skill to be with her bff.
And she's qt.

Writing a kernel in C++, just wrote a custom Tuple implementation:
namespace detail {
template
struct TupleLeaf : TupleLeaf {
template
constexpr TupleLeaf(U &&u, Us&& ...us) : TupleLeaf(forward(us)...), value(forward(u)) {}

constexpr TupleLeaf() = default;

T value;
};

template
struct TupleLeaf {};

template
struct first {
using type = T;
};
}

template
struct Tuple : detail::TupleLeaf {
static inline constexpr usize size = sizeof...(Ts);
static_assert(size > 0);

constexpr Tuple() = default;

template
constexpr Tuple(Us&& ...us) : detail::TupleLeaf(forward(us)...) {}

template
constexpr auto &get() {
static_assert(i < size, "Index out of bounds");
return get();
}

template
constexpr operator typename detail::first::type () {
return get();
}

private:
template
constexpr auto &get() {
if constexpr (i == 0) {
return static_cast(*this).value;
}
else if constexpr (true) {
return get();
}
}
};

template
Tuple(Ts...) -> Tuple;

template
struct tuple_size {
static inline constexpr usize value = sizeof...(Ts);
};

template
struct tuple_element {
using type = decltype(trait::declval().template get());
};


Find something wrong with it.

I'm not sure how to replicate that.

>the "mutible mutable reference" autist
It's "mutable", fucktard. And I am that poster, but most of the posts from your screenshot weren't mine, and the second poster in the other thread wasn't me either. To be frank with you, I feel a mild sense of accomplishment seeing the detrimental effect I'm having on your mental state. Look out, kid, one of those days you'll start seeing "me" back on Reddit, or maybe even standing on your porch.

Thoughts?

MODULE Summer
IMPLICIT NONE
REAL, SAVE, PRIVATE :: fred = 0.0, joe = 0.0, bill = 0.0
CONTAINS
SUBROUTINE A
IMPLICIT NONE
fred = fred+1.23
END SUBROUTINE A
SUBROUTINE B
IMPLICIT NONE
joe = fred+0.7
END SUBROUTINE B
SUBROUTINE C
IMPLICIT NONE
bill = fred+joe
END SUBROUTINE C
SUBROUTINE D
IMPLICIT NONE
PRINT *, bill
END SUBROUTINE D
END MODULE Summer

...

>yeah that's me, but I swear those were different people
No wonder it took you this much time to recover from that, literal fucking autist

What hocus pocus witchcraft is that?

No.63227800

- Programming languages if they were tea -

>C would be black tea:
without anything added to it, not very enjoyable unless you're willing to deal with the bitterness. Most agree that it's better if you add something to it.

>C++ would be C with milk:
comparatively good, but if you drink too much at once you begin to feel bloated.

>Java would be C with soymilk:
Why the fuck would you do that to black tea?

>C# is C with milk and sugar:
it's difficult to taste the black tea itself at this point, but it's much more enjoyable than plain black tea (and far more enjoyable than that soymilk abomination you tried a few years prior).

>Scheme Lisp would be matcha:
Most people don't even understand how to make it, but those who do swear by it. Some thinl that it helps facilitate reaching satori, but others think that it's quite a fuss for just a tea.

>Ruby would be Japanese green tea:
"An acceptable Lisp" according to some, although most agree that it's not quite as much of a mind changer as matcha.
Also, it comes from Japan.

>Python would be Chinese green tea:
Historically in competition with Japanese green tea, those who drink it insist that Japanese green tea is just silly, and that matcha is absolutely absurd.

>Haskell would be oolong:
Most haven't even tried it, but those who do become deeply involved with its odd lingo ("gong fu", "gaiwan", "yixing") and come out of it feeling they've truly experienced tea as it was intended to be experienced.

>Assembly:
Why are you eating those leaves raw?

Fortran 90. Is it really that alien to you?
Kids these days.

posted on /r/programming

it was half a joke, i just don't see it enough though.

>y-you can never recover b-because i keep screeching that it's all you
Literal mental illness. Either way, this isn't progressing anywhere.

Have fun writing 30 instances of matched(), close() and other common functions because your piece of shit cnile trash doesn't either have overloading or traits.

What a fucking retarded mongrel

>this isn't progressing anywhere.
It's definitely not progressing in your favour, autist

>being this subhuman
Still waiting for a technical reason explaining why that verbose trash is better. Protip: "b-because you may need to add another line to the case if they invent a new type of bracket one day" is patently absurd.

/* `_Bool' type must promote to `int' or `unsigned int'. */

typedef enum {

false = 0,

true = 1

} _Bool;


/* And those constants must also be available as macros. */

#define false false

#define true true

>replace true by true
can someone explain this to me?

I reminder confronting this exact crap in apple's cctools when I was building it on linux.

>It's definitely not progressing in your favour, autist
What, because every time you screech autistically at other posters that they're all secretly me, you become even more convinced of it?

but to answer your question: it's likely so that other files can express this like this
#ifndef true
# define true my_true
#endif
to avoid introducing multiple definitions from several sources.

It's not about another line, you fucking braindead cock gobbling piece of shit, it's about repeating the same function over and over again

imagine being that autistic

why not just define true as 1?
is enum better than that define _Bool as int

>about repeating the same function over and over again
Repeating what function, you literal subhuman? Name the specific function that you would have to write more than once.

closed()
close()
simplify()
item_count()

What's the point of C when C++ exists?

>Cross platform framework/language
>Made by Linux/OSX programmers
>Windows support is "important"
Why do 99% of these shits feel the need to not follow proper rules when it comes to Windows? They put shit in the right places for OSX but on Windows they think it's fine to pollute %userprofile% with their shitty fucking retarded file and folders that start with a . for no good reason at all. I am pretty sure Linux users wouldn't appreciate it when your program writes it shit to /C/Users/username/AppData/{Local, Roaming}/programname or to /C/Program Files/programname. It even got this far that even Microsoft itself has started writing their shit to %userprofile% because "OPEN SOURCE CROSS PLATFORM".

Is this UB if I make sure non-const get doesn't modify anything?
I don't want to write get twice.

template
constexpr const auto &get() const {
return const_cast(this)->get();
}

int can take other values than 0 and 1, so it's some kind of compile time safeguard against invalid values. In C99 it's preferable to avoid all this and use stdbool.h.

>closed()
>close()
>simplify()
>item_count()
Why would you need to write any of them more than once, subhuman? You realize making bizarre and baseless statements =/= making an argument, right?

C(uck):
>close_braces
>close_brackets
>close_parens
>close_angle_bracket

Non subhumans:
>Brackets::close()

Fucking brainlet.

Is inheritance the most overrated and overhyped feature in OOP?

>not using namespaces to simply resolve naming conflicts

not if you do your architecture properly

Inheritance is a useful metaprogramming hack.

Nearly everything that exists in C++ and not C is bad

How to setup Haskell environment on Arch?
Googled and I don't find much concrete stuff, only people complaining about how annoying it is.

What are you on about, subhuman?
char close_bracket(char c) {
switch(c) {
case '[': return ']';
case '(': return ')';
case '{': return '}';
default: assert(!"fugg");
}
}
close_bracket(c);

I can see why you'd see it that way, if you were retarded.

>Inheritance is a useful metaprogramming hack.
Oh, hey there. Are you the "storing a function pointer in a struct is a useful FP hack" fucktard?

You should not be using Arch of you're so retarded you can't install ghc.

...no

>No distinction among brackets
This is how I know you never went past middle school
You know what they say, can't spell cuck without c

>more delusional drivel
I accept your concession.

Someone fill me in on whatever this autistic discussion is about.

>get BTFO twice in a row
>"m-more delusional drivel"
Cniles are very "simple minded"

>fill me in on whatever this autistic discussion is about
Which one of them?

I want my metaclasses in c++ already.

The one about brackets.
It seems to span multiple threads and seems extremely autistic.

Background:
You are working with ATS.
C-tard:
Don't generalize brackets for common operations
Rust tard
Generalize brackets for common operations

Come C++20, C++ will finally have interfaces

>y-you need to write 5 functions!
>i can just write Brackets::close()
>"close_bracket(foo);"
>o-okay! but can't spell cuck without a c! haha i win
The absolute state of Rust... I can't tell if all of you are schizophrenic, or if it's the same schizo over and over.

It's coming in C++20. So just wait 2 years.

I thought metaclasses wouldn't land before at least c++23.

AST*

>The one about brackets.
Oh, that one. Summary:

That was just some retard.

How will metaclasses introduce the ability to have interfaces?
I don't think it'll solve the vpointer problem, or am I wrong about that?

C major mistakes:
>preprocessor
>pointer arithmetic

You don't need to write 'static for consts and statics

Brackets::close_paren(tree)
meanwhile cnile:
close_paren(tree)
close_braces(tree)
close_angle_bracket(tree)
close_brackets(tree)
>I can't tell if all of you are schizophrenic, or if it's the same schizo over and over.
No it's just you

I don't actually know, I'm mainly shitposting. Probably?

No one ITT works with C. I can guarantee you. C is a dying language

array-pointer """equivalence""" is the main one

I am working on my game engine written in C11.

By working I mean getting paid, basement dweller

Sepplesfag here.
Nothing wrong with pointer arithmetic.
I have a right to offset my pointers, since after all, it's a basic freedom, and quite useful.
Even Rustfags have pointer arithmetic, it's just hidden away behind unsafe interfaces.
I don't know how you would even be able to do a lot of things if not for pointer arithmetic.

redpill me on unsigned ints

Nothing wrong with them.
Necessary for systems programming.

impl SquareBracket

Usually you get paid for working with tools you wrote in C. So for the engine you would in the end get paid when writing Lua/Python/whatever-other-binding-lang. So you're not earning directly from the C tool, but the C tool is your core earning asset.
Like, nobody ears from nginx itself, or at least very little, but tons of sites based off nginx make tons of cash.
It's not. You just got confused by array pointer decay.
Unions and these operators (&, [], ->, *) cover 100% of portable uses.

close_bracket(0)
>This isn't a compile time error

I figured.
You can already write interfaces in c++ today. But with MetaClasses you can create an Interface metaclass so that you can write
interface SomeInterface {
void do_shit() const; // virtual = 0 is automatically applied by interface
int return_1(); // virtual = 0 is automatically applied by interface
//virtual ~SomeInterface() = 0 is automatically add by the interface
};
SomeInterface will automaticly have a virtual destructor, do_shit and return_1 are public by default and are also virtual.
If you add a private: specifier or a data member into the interface you can have the compiler throw and error because you can't have private methods or data members in an interface. That's just one of the things metaclasses will be able to do.
Herbs talk about metaclasses on cppcon 2017 was pretty nice, the paper he wrote is also a nice read.

>"interfaces"
>intrusive vptrs
try harder

>check future user input at compile time

>Unions and these operators (&, [], ->, *) cover 100% of portable uses.
Are you retarded?

&a[i]
= &(*(a + i))
= (a + i)
= a + i

>He doesn't know that array subscription is defined in terms of pointer arithmetic.
Brainlet, get out.

>no sanitization
>lul why were there a 0 in the AST let's crash the program now xddd

C programmers are really really "simple minded"

I understand array decay, the fact that so many people don't is evidence that the idea is flawed.

Yes but all of that is pointless if it doesn't address the vpointer issue.

Rustlets are cancerous, but you're the retard in this case. What he was trying to say is that most use cases for pointer arithmetic can be covered without providing direct access to it.

>Are you retarded
I'm not. I know it's syntactic sugar.
Just because it's defined in terms of pointer arithmetic it doesn't mean other kinds of pointer arithmetic should be allowed.
>inb4
This workaround would mark unsafe and unportable code.