[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 371
Thread images: 23

File: Calculus of Maki Constructions.png (312KB, 452x355px) Image search: [Google]
Calculus of Maki Constructions.png
312KB, 452x355px
What are you working on, /g/?

Previous Thread: >>60837216
>>
rust a shit
>>
>>60841126
I'm programming my AI Maki
>>
C++ is vomit
>>
File: Capture.png (51KB, 657x154px) Image search: [Google]
Capture.png
51KB, 657x154px
nth for the B E A U T Y of Rust
>>
C++ is garbage
>>
Idris is the most practical language.
>>
>>60841154
in haskell this is just

first = (!!1)
>>
Rust is trash
>>
File: 1495641113909.png (72KB, 1016x98px) Image search: [Google]
1495641113909.png
72KB, 1016x98px
nth for the B E A U T Y of C++
>>
>>60841167
kek
>>
>>60841160
in d this is just
arr.ptr
>>
>>60841154
Got what an ugly fucking language
>>
Rust is the future, whether you like it or not
>>
>>60841154
>fn
this is LITERALLY fucking garbage

rust is so fucking shit the language designers have failed on even the most basic things which is utterly inexcusable since they don't really have the baggage of C or anything
>>
>>60841167
>It's real
C++ lives upto it's name for ugliness
>>
>>60841167
V O M I T
O
M
I
T
>>
>>60841200
that's a contrived example and rust is just as ugly even in the most trivial examples
>>
>>60841167
>There are people who'll defend this
>>
>>60841167
My fucking eyes
>>
>there are people who will defend this

firstTruthy :: Monad m => (a -> Bool) -> [m a] -> m (Maybe a)
firstTruthy f = foldr
(\x r -> x >>= uncurry (bool r) . (return . Just &&& f))
(return Nothing)
>>
>>60841167
Only a mongrel will tolerate this
>>
>>60841244
>posters
>7
we get it, enough with the samefagging mozilla shill
>>
>>60841167
int x = 1
int x (1)
int x {1}

:^^^)
>>
Implemented my own generic vector, hashmap, object pool and allocators in C.
Didn't want to do that but Glib is too huge and the alternatives were either not cross platform, did not specify supported platforms or were in general just unusable.

When can't there be C with better standard library and smarter compiler features?
>>
Even if you disregard C++'s ugliness how the fuck can you stand a language who's creator is a windows shill?

wtf?
>>
>>60841256

>Generic
>C
Please don't tell me you used void*
>>
>>60841232
>[]
>not generalising to forall t. Traversable t => t
>>
>>60841267
how is he a windows shill lmfao? and what does it matter? nice ad hominem
>>
>>60841281
>how is he a windows shill lmfao?
His C++ book literally shills windows
>what does it matter
why*
Enjoy your proprietary language, faggot
>>
>>60841273
MACROS you fucking retard, though the hashtable currently works with only void* but it wouldn't be hard to implement it with macros to make it fully generic.
>>
>buy K&R
>see this
have memes gone too far?

>>60841267
>linux project outright rejected C++
why would he endorse linux when microsoft welcomed his language with open arms?
>>
>>60841299
>His C++ book literally shills windows
Do you mean that he just assumes Windows and MSVS?
Those are two different things.
>>
>>60841299
https://www.merriam-webster.com/dictionary/what%20does%20it%20matter

https://www.bayt.com/en/specialties/q/15633/is-c-a-proprietary-language/
>>
File: gee starter pack.png (85KB, 825x310px) Image search: [Google]
gee starter pack.png
85KB, 825x310px
>>60841308
forgot my pic
>>
>>60841211
>t. Bjarne
>>
>>60841308
>Linux project outright rejected C++
He doesn't seem to include any instructions for *BSD users. C++ is for wincucks
>>60841314
>Assumes
Why would it?
>>
>>60841303
>MACROS
absolutely disgusting
>>
>>60841314
>Do you mean that he just assumes Windows and MSVS
So you have to be a wincuck to read the C++ bible?

Even more reasons to hate C++
>>
>>60841336
>why would a book on programming assume the dominant platform and its first-party IDE
Who knows.
>>
>>60841303
>macros are better than void pointers
wew lad

>>60841314
You can't run MSVS on Linux.
>>
>>60841354
>the dominant platform
There are more *nix developers than wankbloz developers
>>
>>60841336
>He doesn't seem to include any instructions for *BSD users.
Because BSD is even less prevalent than Linux?
>>
>C++ is a wincuck pajeet language
I fucking knew it
>>
>>60841363
only on /g/ and they're not real developers they're mostly underage/manchild neckbeards
>>
>>60841308
>memes
>>>/v/
>>
>>60841373
Stackoverflow, fucktard
>>60841368
Who the fuck uses wankbloz, are you one of those (((gayme devz))) as well?
>>
>>60841363
Were talking about employed people here anon.
>>
>>60841368
Mac users are *nix devs too
>>
>>60841394
So Java users?
>>
>>60841399
>Mac users
They aren't devs. Mac devs are somewhat nixen-developers, but bastard ones.
>>
>>60841369
Can't make this shit up. C++ is full of pajeets
>>
>>60841414
So winoze """koderz""" are the minority. I feel sorry for you, pajeet
>>
>>60841414
So basically C++ is a windows lock-in trash? wew
>>
>>60841407
All the pajeetlangs, yes. Windows is still the most relevant platform.
>>
>>60841424
I'm on your side you dumb nigger
>>
>>60841432
For pajeets and gayme koderz? May be. If so you belong to >>>/wdg/ or >>>/vg/
>>
>>60841432
Look beyond the workstation anon.
>>
>>60841432
Windows is the minority in development platform, you currymunching wincuck!
>>
>>60841167
>void(*)(ReturnTypeReturnType*)
why.
>>
>>60841443
I am, Debian + Freebsd, lad.
>>
>>60841451
Because C++ is made to cater pajeets
>>
>The amount of windows shilling ITT
>>
>>60841399
Not in the 1990s they weren't.
>>
I want (kind have) to write a LISP interpreter in Lua. Is Racket a good choice for the dialect?
>>
>C++ is windows shill
>but doesn't let you use any of the superior features of the windows platform
Really makes you think...
>>
In JavaScript, how do I make it if 2 dice are rolled and they are both the same number, then the user gets no points, if it is different numbers then they are added up as points.

if (dice !== 1 && dice2 !== 1) {
//add score
roundScore = dice + dice2;
document.querySelector('#current-' + activePlayer).textContent = roundScore;
} else {
//next player
}


For some reason its not adding points if just 1 dice is 1, I want it to only not add points if both are 1, how do I fix this. Thanks.
>>
>>60841494
I'd go with the simplest Lisp dialect.
>>
>>60841494
It's the dialect I prefer, but I'm not 100% confident it's simple to implement tbqh senpai
>>
File: 0.png (5KB, 720x540px) Image search: [Google]
0.png
5KB, 720x540px
Should recursion be avoided at all costs? Or are there situations where it's an acceptable solution to a problem.

More concrete: I have a tree. I want to destroy a sub-tree, each element one by one.
This problem to me screams "recursion", but I've heard recursion is not very good for performance and stuff like that (not sure how much of that is true for C++).
Should I go the easy route and solve this with recursion or go convoluted but without recursion?
>>
>>60841503
>C++
Found your problem
>>
>>60841533

No, recursion is the best way to do it.
>>
>use an and statement
>UHH WHY DOES IT ONLY WORK WHEN BOTH THINGS ARE TRUE

fucking christ
>>
>>60841494
No you dumbfuck. Racket is scheme + shitons of extensions.
If it for school you implement the 7 operators that are needed to implement scheme.
If you need to actually implement working scheme then look for the smallest r4rs scheme implementation.
>>
>>60841518
>>60841527
>>60841569
Okay, thanks. Scheme it is.
>>
>>60841533
Some C++ compilers do TCO, so you could be good actually writing the tail recursion and be done with it. However, even if the final code isn't recursive, it's not a sin to reason in terms of a recursive algorithm and then flatten it into something non-recursive. That's what I often do personally
>>
>>60841533
>i heard recursion is bad

who told you that? your instructor pajeet?
>>
>>60841473
So it basically goes back to the beggining of the conversation, when I said, that the following two statements are contradictory:
>Language has FCF if it can pass, and store functions as data [implicitly: it doesn't need to have closure functionality]
>C is not considered to have FCF because it doesn't have closures
According to the wikipedia definition C does in fact have first class functions.
It just doesn't have closures to elevate those first class functions to be more useful.
>>
>>60841594
>C++
yes
>>
File: 1234567890.png (115KB, 322x276px) Image search: [Google]
1234567890.png
115KB, 322x276px
>/dpt/ hates C++
Stupid hipsters. I bet none of you work in the industry either.

Truly sad.
>>
>>60841533
>Should recursion be avoided at all costs?
yes. recursion is only shilled by brainlet newfags who think it's cool because they learned it in cs101 last week

use an explicit stack to traverse the tree. it's not convoluted at all
>>
>>60841611
If you worked in the industry you would use Java, faggot
>>
>>60841597
Yup, I was trying to bring something more out of the definition, but realized I won't manage to.
>>
>>60841597
Imma stir shit up in your discussion m8.

Common Lisp doesn't have FCF. Instead it's stuck with passing symbols around and looking them up in the defun obarray slot or whatever it's called. Fucking pathetic. C beats CL in this regard.
>>
>>60841611
Well of course they don't.
How can underage people work in the industry?
>>
>>60841611
>>>/dpt/ hates C++
I thought that too, but then I realized it's literally just a handful of shitposters who have nothing better to do with their life.
>>
>>60841621
C++ is one of the top languages faggot
>>
>>60841621

everyone hates Java.
>>
>>60841611
>liking sepples is required for working in the """industry"""
You do realize that most people hate their job?
>>
>>60841621
The reason Java job pay more is because it is so niche faggot.
>>
>>60841640
Java>Python>JS>Ctrashtrash

Sorry, your microsoft C loses here too
>>
>>60841643
no they don't, not even in a tiny circlejerk like /dpt/
>>
>>60841651
>Implying I don't use g++
>>
File: 1486403872071.png (174KB, 962x543px) Image search: [Google]
1486403872071.png
174KB, 962x543px
How can I work in """the industry"""? I'm already taking my hindi courses and learning Microsoft Visual C++. But I still need English subtitles :(
>>
>>60841651
Python>JS yeah
Java>C++ ok
but Python>Java you're in space m8. Java's design is retarded even for a procedural language, while Python is an honorary LISP-sensei.
>>
>>60841611
That's because there's no proper alternative to C++.
>>
>>60841667
Bjarne openly shills microsoft
>>
>>60841514
if(dice1 === dice2) // Equal numbers, no points
{
alert('no points, anon!');
}
else // if the numbers are not equal, we know they are different, so get points
{
roundScore = dice1 + dice2;
}
>>
>>60841676

Java's syntax is pretty clear and straightforward m8. There's not much to get snagged on.
>>
File: 1417272331969.jpg (2KB, 125x125px) Image search: [Google]
1417272331969.jpg
2KB, 125x125px
Has it always been like this, or did /dpt/ just recently become 75% shit slinging with hardly any reasonable discourse?
I don't see as much vitriol in other generals.
>>
>>60841673
Start shitting in the street and make 3 Microsoft shilling threads on /g/ each day. You will get a job in "the" industry in no time
>>
>>60841704
Assuming you are familiar with a C style language.
>>
C++ is for pajeets who think they are "too smart for Java"
>>
>>60841706
/dpt/ has always been /language wars general/
>>
>>60841722
>C# is for pajeets who think they are "too smart for Java"
ftfy
>>
>>60841722
Pajeets are smarter than you, hobby developer.
>>
>>60841650
>so niche
>literally the top used language in the world

get a fucking grip retard
>>
>>60841706
i think it has gotten worse lately but there has always been a lot of shitposting

https://wiki.installgentoo.com/index.php/Daily_programming_thread#The_Image_Wars
>>
>>60841736
Whatever you say, pajeet
>>
>>60841749
Don't you have an indie pixel platformer to put up on Steam greenlight?
>>
>>60841734
this

also scala, kotlin
>>
>>60841616
>>60841533
It goes like:
>cs 101
//simple recursion
int factorial(int n)
{
if(n == 0)
return 1;
else
return n * factorial(n);
}


>cs 102
//recursion is bad!
int factorial(int n)
{
int m = 1;
for(int i=2; i <= n; i++)
m = m * i;

return m;
}


>cs 103
//actually fuck imperative programming
int factorial(int n)
{
return fact_aux(n, 1);
}

int fact_aux(int n, int acc)
{
if(n==0)
return acc;
else
return fact_aux(n-1, acc*n);
}
>>
>>60841773
Don't you have a street to shit on right now in your shitty wincuck lang?
>>
>>60841706
It has gotten considerably worse lately.
My theory is that the us 2016 election brought in legions of newfags which are now pouring outside of /pol/ and into other boards.
That plus the summer factor.
>>60841741
There's always been shitposting but this general is past that point now. There's a difference between the classical definition of shitposting and just posting irrelevant and not funny shit.
>>
>>60841792
>wincuck language
And there it is. You don't hate C++ because it is shit, you are jealous of it because it is better but not Stallman approved.
>>
>>60841810
Every one knows C++ is shit. I just have more reasons to hate it
>>
>>60841820
>Everyone
Pathetic.
>>
File: 1487463346465.png (100KB, 1244x1024px) Image search: [Google]
1487463346465.png
100KB, 1244x1024px
>>60841827
A little hurt?
>>
>>60841827
C++ IS shit though
>>
>>60841850
>Opens his post with a lie
Nice.
>>
>>60841850
I have been programming in Rust for nine decades and I honestly think Eiffel is probably the best language in the current timeline.

Let me show you why with this super specific problem...
>>
>>60841686
GCC is written in C++.
>>
>>60841879
>>60841934
So this is the power or wincuck shills
>>
>>60841943
It was primarily written in C, the C++ extensions were added in C
>>
>>60841949
>the C++ extensions were added in C
wut
>>
>>60841706
I blame it on the Rust shills.
>>
>>60841944
>>60841792
>>60841707
>>60841686
>>60841503
>>60841450
So this is the power of a sperg with a buzzword.
>>
>>60841962
of the GNU Compiler Collection. Are you autistic
>>
>>60841943
C++ was implemented in C
>>
>cniles arguing with C++ajeets
ah yes
>>
>>60841850

Real talk: why aren't explicit specializations in non--namespace scopes allowed?
>>
>>60842009
Because C++ is trash?
You can realize C++ is trash by a fucking hello world program
std::cout<<"Garbo"<<std::endl
>>
>>60842005
Grow up.

This is why /g/ is shit compared to Stackoverflow.
>>
>>60842017
>C++ is trash because I don't understand what the standard namespace is fo
>>
>>60842017
Abomination
>>
>>60842017

All of C++'s ugly bits have some justification, however weak. What's the reasoning for this?
>>
>>60842034
>Overloading < for io
AHAHAHAHAHAHA
>>
>>60842057
Try making a stream object in C and find out.
>>
Total number of Rust lines in this thread: 3 (in an image, not even written).

Do you even program, /dpt/?
>>
>>60842034
ENJOY::YOUR::<<**SHITTY**>>::LANG::TURD
>>
>>60842076

I'm not talking about streams, I'm talking about template specialization.
>>
>>60841850
C++57 will fix this!
>>
>>60842086
Oh well then I don't know because I agree that templates are shit. But manipulators absolutely can be justified and std:: can be left out by including namespace std.
>>
>>60841978
I'm talking about the language the compiler itself was written in. GCC is written in C++.

>>60842059
'<' is not '<<'.
>>
>>60842077
The PR guy of Rust, Steve Klabnik, is an Antifa member. His Twitter is full of Marx and Lenin propaganda. There's also a post of him making fun of a police officer on fire. How am I supposed to take this language seriously?
>>
>>60841611
I have to work with it. That's why I hate it smug anime girl who's probably unemployed.
If you were using it as a hobby language it'd probably be fine.
>>
hey guys I am new to C++. What's the equivalent of foreach loop in C++?

for example given an int array, I want to see if any index is equal to the array element.
>>
>>60842121
GCC was primarily written in C, some of the the very first projects of C++ was compiled with G++
>>
>>60842128

for (int i : arr)
{
// Do your shit
}
>>
>>60842152
No, I want to get the index if index = arr[index]
>>
>>60841126
I finished HoTT book finally. What I like about Robert Harper involved books is he makes them totally self contained, you can either skip the 200 pages or so of review if you want or you can get a crash course in Basic Proof theory/Constructive Logic.
>>
>>60842123
ESR used to argue pro nazi eugenics on newsgroups back in the day and that doesn't stop anybody from still reading his Art of Unix Programming book, it's still a good book.
>>
>>60842128
Over a decade of work on this and c++ has finally arrived at:
http://en.cppreference.com/w/cpp/language/range-for
>>60842157
Oh, all for naught. Do a normal for i loop and index into the array.
If you want you can do a local variable inside the forloop to rename the indexed element of the string. It's pretty close..
>>
>>60842157
foreach(index, number; numbers) 
if (index == number)
//do stuff

Not sure about C++

>>60842188
What do you mean, C++ can't enumerate a foreach loop?
>>
>>60842137
The current GCC source code is written in C++. I'm not asking what is used to compile C++.
>>
>>60842214
>>
>>60842077
Fine here, specially made for you
type LitersOfCum = u64;
type Gayness = u64;

trait Gay {
fn suck_dick(&mut self, amount: LitersOfCum);
}

struct You(Gayness);

impl Gay for You {
fn suck_dick(&mut self, amount: LitersOfCum) {
self.0 += amount;
}
}

fn main() {
let mut fgt = You(0);
fgt.suck_dick(std::u64::MAX);
println!("(You) sucked {} liters of cum.", fgt.0);
}


Output:
(You) sucked 18446744073709551615 liters of cum.
>>
>>60842188
>http://en.cppreference.com/w/cpp/language/range-for
Holy fuck it really can't
"over a decade of work"
Jesus christ LOL
>>
>>60842232
http://www.h-online.com/open/news/item/GCC-allows-C-to-some-degree-1012611.html
>>
>>60842179
Steve Klabnik pushes Antifa ideology into Rust. ESR has never done that.
>>
>>60842244
kek
>>
>>60842197
No. You'd think that they'd give you the index like they give you the key and value pair with std::map (never use std::map, ever, it's simply bad) but it's a mess.

I don't see why people blame C anymore. It's clear they're completely incompetent.
>>
>>60842256

>anon is too dumb to put a counter ina a for loop
>>
>>60842232
I hope that clears up the confusion, GCC was and still is primarily written in C, then Ada.
>>
>>60842280
He shouldn't have to. That's ugly af. Any decent language wouldn't force you to do that. C++ isn't a decent language.
>>
>>60842280
Are you from 1950?
Is it too hard to fucking enumerate a range? Shame on you, especially after you working for over a decade
>>
>>60842294
>Decent languages are more bloated
>>
>>60842244
>
(std::u64::MAX);

God, Rust is such a fucking trash.
>>
>>60842318
>C++ isn't bloated
>>
>>60842123
this, and even the people/politics aside, the language itself is fucking terrible
>>
>>60841621
>>60841640
>>60841650
faggots
>>
>>60842325
I bet you use C++ too, why the double standard?
>>
>>60842327
>No u
>>
>>60842280
A decent language with foreach loops has something equivalent to
for (index, elem) in arr.enumerate() {
...
}
>>
>>60842336
if a language is supposed to replace C++ it should be better in some way
>>
File: 1458250012095.jpg (38KB, 604x437px) Image search: [Google]
1458250012095.jpg
38KB, 604x437px
>12+ fucking years
>Can't enumerate a foreach loop
Let me join in:
C++ IS GAY
>>
>>60842318
Do you think allowing an optional iterator return value for the standard vector would be more bloated? It's already 'bloated' in the case of many of the std data containers.
>>
>>60842294

Iterators aren't there to enumerate, they're there to iterate. If the iterator also enumerated every time it iteratored, that would be unnecessary overhead. Turning an iterator into an enumerator in a for loop is two lines.
>>
>>60842351
Modules
>>
>>60842351
Not easily segfaulting is not better?
>>
>>60842336
Meanwhile in a good language.
ulong.max
>>
>>60842369
>easily segfaulting
tell that to a real C++ developer

smug hipster blogger fags who tried it for a couple of days don't count
>>
>>60842375
D? We know C++ can never as beautiful as D, it's just an impossible target for them
>>
>he uses programming languages
>>
>>60842382
What makes him a complex C++ developer?
>>
>>60842367
>One fucking word to cuck all C++ajeets instantly
Unfair
>>
>>60842382
Fuck you, running a blog takes worlds more dedication than your shitty "language" and the only reason anyone hates "hipsters" is because they know we're fucking right.
>>
>>60842264
Can you give specific examples?
>>
>>60842383
Are you a necrophiliac?
>>
>>60842391
it's not a real issue. C++ build systems work the same as in C which is fine. and future versions of C++ are getting your faggy ass modules
>>
Times are changing, grandpa. C++ was just as a meme when it first came out and no one took it seriously over C
>>
>>60842419

>still no replacement in sight
>>
>>60842417
Are you a pajeet?
>>
>>60842404
t. pretentious blogger hipster fag
>>
>>60842425
Rust. It already has multiple kernels written in it. Let's see how many kernels were written in C++ in 2 years
>>
>>60842419
You began that paragraph with "times are changing."

You then proceeded to discuss how they've stayed the same.

Please explain yourself.
>>
>>60842432
Maybe someday Rust will even be able to print variables.
>>
>>60842418
>still not an issue
>b-but we will be getting modules in C++75 I promise
Cry harder
>>
>>60842432
>trannies are this delusional
>>
I honestly cant wait for sepples modules just to see how much more of a clusterfuck they make the language.
>>
>>60842440
What?
>>
>>60842439
>You then proceeded to discuss how they've stayed the same.
No?
>>60842449
>Pajeets are this deluded
>>
>>60842364
So why don't you give the programmer a nice way to enumerate while iterating? It could be entirely optional. It's trivial to implement. It follows the 'you don't pay for what you don't use' easily. Except for compile times. But they've completely ignored that aspect of 'you don't pay' clearly.
>>60842157
 
std::cin >> str;
for (char& c : str) index=&c - &str[0]

This should work on any contiguous storage. But I don't remember how C++ handles arithmetic on non-char pointers. I remember that being a caveat in C. Undefined behavior if you perform arithmetic on them iirc.
>>
>>60842431
>pretentious
>brainletspeak for "intelligent"
>probably doesn't even veganism and Starbucks
>>
>>60842432

which of these does anyone use?
>>
in java I can define a final member in the constructor. how do I do that in c++ with const members?
>>
>>60842415
People of diversity getting a free ticket to RustCon(?)
Dining philosophers problem GitHub issue
Code of Conduct
>>
>>60842451
Nothing will save C++, it's a dead language walking
>>60842459
EWWWWW
>>
>>60842244
Well done, anon.
>>
>>60842462
I don't use one written in C++, after half a century.
>>
>>60842264
Not really, the core problems of being a commie mean Rust core devs will never get consensus on anything and never finish anything on time. There isn't actual commie propaganda being pushed into the language spec or anything.

The biggest problem with Rust is OCaml, Erlang and modern C++ can do everything it claims it can do except OCaml and Erlang libraries can be more easily formally verified. For example most financial trading is done with a rewritten OCaml core library where the garbage collector doesn't get in away or is completely removed, yet you can formally verify your trading algorithms. Erlang the same deal, there exists completely optimized GC that makes everything Rust touts as redundant.

However there's no financial backing to push OCaml as a systems language or w/e so Rust it is then.
>>
>>60842444
rust doesn't even have a chance to be relevant until several years from now, by the time C++ will have modules, and your argument will be moot

and keep ignoring the fact that C++ build systems already work fine like in C
>>
>>60842489
>by the time C++ will have modules,
You have to wait at least half a decade until compilers get it

Earlier some C++ajeet was crying when C++17 is going to be implemented. LOL
>>
>>60842489
C++ modules wont fix namespaces though, which are really the main draw of modules in the first place.
>>
File: Sophie_Wilson.jpg (291KB, 640x426px) Image search: [Google]
Sophie_Wilson.jpg
291KB, 640x426px
>>60842449
>being a transphobe
I hope you don't own a mobile phone or smartphone, anon, I might have some bad news for you.
>>
>>60842517
delete this
>>
I think at this point we can all agree:

D > /dpt/ < C++
>>
>>60842465

struct Foo
{
const int a;
const char b;
Foo(int _a, char _b):
a(_a), b(_b)
{ };
};
>>
>>60842459
>undefined behavior
Yep. Here it is.
https://stackoverflow.com/questions/10473573/why-is-out-of-bounds-pointer-arithmetic-undefined-behaviour
Pointer-pointer is certainly not going to be within the pointer range of your array. Undefined behavior. Sorry for giving you hope.
>>
>C++
Isn't that the rebranded C for brainlets with 2 standard libraries
>>
>>60842523
being a tranny isn't normal outside of your bay area/seattle commiefornia circlejerk
>>
>>60842459
>std::cin >> str;
>for (char& c : str) index=&c - &str[0]
Jesus christ how fucking horrible
>>
Mods delete this thread.

/dpt/ is going full retard.
>>
>>60842485
>most financial trading is done with a rewritten OCaml core library
Please stop posting, you're embarrassing yourself.
>>
>>60842510

Clang and MSVC already have modules, you ignorant shitter.
>>
>>60842459
>>60842532
>this ugly and it doesn't even work
Can we really not solve this problem?
Really?
>>
>>60842539
Modern computers are invented by a leftist faggot.
>>
File: ls.gif (120KB, 480x270px) Image search: [Google]
ls.gif
120KB, 480x270px
does lsd make you a programming god?
>>
>>60842539
Sophie is an Englishwoman tho.
>>
>>60842552
>NON-STANDARD MODULE SYSTEM IMPLEMENTATION
Can C++ be even more shittier? I think it reached the epitome of trash, lads
>>
>>60842563
>Sophie
who?
>>
>>60842523
>middle class minorities get oppressed for being minorities, blame all white males
>working class white males get oppressed for being working class, blame all minorities
>the real oppressors are egging them both on and laughing while rolling in an unending stream of cash
>>
>>60842453
Try compiling this:
fn main() {
let approximately_pi = 3.14159;
println!(approximately_pi);
}


>>60842467
None of those have to do with the language itself. It's like saying C is "misogynistic" because most C programmers are male.
>>
>autisticy manage indentation levels in my code
>no semicolon or comma can be out of place
>rouge newlines must be deleted
>meanwhile my house is stewing in filth
help me dpt
>>
>>60842566

>compilers won't have modules! sepples is shit!
>compilers already have modules! sepples is shit!
Make up your mind, shitposter-kun.
>>
>>60842552
You're willing to trust they won't fuck you over in the standard?
>>
>>60842555
kek this

I mean I hate identity politics myself, but how about not bringing politics into programming? It's not any different than COC faggots
>>
>>60842244
enum Pain {
None,
Some,
Very,
Extremely
}

trait BigGuy {
fn pull_that_off(&self) -> Pain;
}

struct You;

impl BigGuy for You {
fn pull_that_off(&self) -> Pain {
Pain::Extremely
}
}
>>
>>60842485
Rust devs don't push commie ideology, but they do push extreme leftist ideology as I stated in >>60842467.
>For example most financial trading is done with a rewritten OCaml core library where the garbage collector doesn't get in away or is completely removed
I only know of Jane Street and some small companies using OCaml for their core infrastructure.
>>
>>60842580
use an IDE fuckwit
>>
>>60842572
Sophie Wilson, the original designer of ARM CPUs.
>>
>>60842581
>2 standard libraries
>2 separate kinds of modules just to fuck with you and your project devs
>5 ways to define a variable
It keeps getting worse
>>
>>60842553
Unsolved problem in computer science clearly.
>>
>>60842587
kek
>>
>>60842576
>error: expected a literal
THE
STATE
OF
RUST
>>
>>60842581
Their criticism is of the language specification, not ``compilers".
>>
>>60842581
Clang and Micropenis modules don't work the same way you drooling fucktard C++ajeet
>>
>>60842576
Try compiling this:
#include <stdio.h>

int main(void) {
// your code goes here
double pi = 3.14;
printf(pi);
return 0;
}
>>
>>60842576
Here, try learning about the language before shitposting about it
fn main() {
let approximately_pi = 3.14159;
println!("{}", approximately_pi);
}
>>
>>60842467
All of those are just more examples of bike shedding and infighting and general inability to run a hotdog stand competently let alone a language committee so I'm not entirely concerned. We all know when a project is run by commie retards they turn on each other like the Tor project did then they all leave to write sanctimonious drivel on blogs about it, then they are replaced with competent people and life goes on.
>>
>>60842630
try compiling this:

#include <iostream>

int main() {
// your code goes here
constexpr auto pi = 3.14;
std::cout << pi;
return 0;
}
>>
Challenge:
Get the index of the current element of a range based for loop in C++ without causing undefined behavior.
>>
>>60842550
What is Jane Street Capital NYC
What is Two Sigma

both heavily use Ocaml
>>
>>60842630
> incompatible type for argument 1 of 'printf'
THE
STATE
OF
C
>>
>>60842626
That was the criticism originally, and it's a good criticism. Then anon started backpedaling and talked about other shit. >>60842510
>E-even if you do get modules, nobody will support them!
Provably false. Everybody across the board is chomping at the bit to implement this shit.
>>
>>60842232
>>60842283
those numbers are unreliable. the c code has been ported to c++ but they kept the .c extension. gcc is now compiled with g++.

for example, https://github.com/gcc-mirror/gcc/blob/master/gcc/context.c
>>
File: 1490956545793.jpg (94KB, 600x450px) Image search: [Google]
1490956545793.jpg
94KB, 600x450px
>>60842650
>cout
>>
>>60842639
nice boipucci faggot
>>
>>60842576
>None of those have to do with the language itself. It's like saying C is "misogynistic" because most C programmers are male.
I refuse to use a product/service in the hands of an Antifa member because of ethical reasons.
C comes from an era where nobody cared about you as a person.
>>60842643
I doubt that'll happen anytime soon. Rust is in hands of Mozilla. They share the same ideology.
>>
>>60842656
Oh wow, TWO companies use it?! I forgot that only three companies in the world do financial trading. Fuckwit.
>>
>>60842654
>range based for loop
fag
>>
>>60842630
This compiles in C and C++:
#include <stdio.h>

int main() {
char string[] = "Hello, World!";
printf(string);
return 0;
}


This does NOT compile in Rust:
fn main() {
auto string = "Hello, World!";
println!(string);
}
>>
>>60842639
Now how do you print two things in the same println! ?
>>
>>60842697
You are not retarded enough to believe that's not possible, right?
>>60842694
You don't know how println! works, are you pretending to be retarded or just another C++ajeet?
>>
>>60842693
Brainlet.
>>
>>60842694
>This compiles in C and C++:
Wrong
>>
>>60842639
So Rust needs an extra 10 bytes of storage just to print a number?
>>
>>60842692
>only three companies in the world
Sarcasm fail. Any way you could have ended that sentence would have been a lot more accurate than you meant to imply.
>>
>>60842717
if you're using one, you don't need the index, fucking retard
>>
>>60842727
>extra 10 bytes
>10
>fucking
>bytes
How can people be this (THIS) autistic?
>>
haskell!
>>
>>60842694
>auto string
Why are you even shitposting about a language you don't even know the basics of?
>>
>>60842715
Im curious, because with a few seemingly obvious ways i kept getting errors.
>>
>>60842727
>2 chars
>10 bytes
oh shit check out this genius
>>
>>60842692
The others are using Haskell these days, and Java. Even HFT is done in Java more these days, but you know so much about it and clearly have worked on Wallstreet right?

Guys who write HFT systems in Java are basically programming them like one would in C or C++. They pre-allocate byte buffers for everything and never run the GC. If you write C-style code in Java, it's going to run pretty quickly. They aren't doing architecture astronaut AbstractMetaClassFactory stuff or using much of the provided libraries for latency-sensitive code.

But you know all this right Mr. Expert in financial trading? Show me one modern hedge fund or Quant shop that isn't using a functional language
>>
>>60842743
meanwhile
immutable approximately_pi = 3.14159;
writeln(approximately_pi);
>>
What is the square root of -1?
>>
>>60842737
How do you know that? You can't know that. The position in the structure might still be important.
Are you saying it shouldn't even be possible though? Doesn't make sense.
>>
>>60842770

j
>>
>>60842724
Just ignore the warning baka
>>
>>60842758
do you have any resources on this? that sounds like a very interesting style of programming
>>
>>60841154
In Rust, this is just
fn first<T>(v : &Vec<T>) -> &T {
&v[0]
}
>>
>>60842771
Not him but:
>position in the structure
You shouldn't rely on this, structs can contain unnamed padding
>>
>>60842690
>I refuse to use a product/service in the hands of an Antifa member because of ethical reasons.
You're free to do that, but it doesn't mean the language itself has features of "antifa ideology".

>C comes from an era where nobody cared about you as a person.
It's not really the era, I'm pretty sure if Dennis Ritchie was known for openly praising the Soviet Union and calling for the abolition of property rights nobody (in the West at least) would want to use his language.
>>
>>60842769
Why do Rust and D fags fight? Doesn't make sense. Both are pretty nice.
>>
>>60841688
>no points, anon!
not "no dice"
>>
>>60842776
>Just ignore the warning
enjoy your scrambled eggfaults
>>
>>60842755
>sizeof pointer and 2 chars
Clearly 10 bytes on x64 anon.
>>60842790
Were not talking about structs were talking about datastructures like a C++ vector.
>>
>>60842758
The original post said
>most financial trading is done with a rewritten OCaml core library

Haskell is not OCaml. Other functional languages are not OCaml.

Yes you have to write Java like C/C++ in order to get good performance out of it. That is completely irrelevant to my point.
>>
File: seija_delet.png (224KB, 912x848px) Image search: [Google]
seija_delet.png
224KB, 912x848px
>>60842775
>>
>>60842697
fn main() {
let approximately_pi = 3.14159;
println!("{0} - {1} = {2}", approximately_pi, 1, approximately_pi-1 as f32);
}
>>
>>60842758
>Even HFT is done in Java more these days,
I've heard that on Devoxx last year. The guy who did the speech worked in HFT and used Azul Systems mainly because of its superior garbage collector.
>>
>>60842795
Wrong they're both shit, asm is the only good language
>>
>>60842840
I kode in machine kodez, bro. Up ur game
>>
>>60842791
Antifa and Rust share the same extreme leftist ideology. Pro diversity etc...
>>
>>60842715
>You don't know how println! works
It does not work in a way consistent with other languages' print functions.

>>60842750
Yeah I meant let, not auto in the rust example lol. Even so it gives a "not a literal" error.

>>60842755
1 byte per character (UTF-8 encoding), plus another 8 bytes to the store the length of the format string literal.
>>
File: a-anon-hwy-lr-wee-doin-this.png (316KB, 749x671px) Image search: [Google]
a-anon-hwy-lr-wee-doin-this.png
316KB, 749x671px
>>60842809
>he still segfaults
>>
File: 1305926326382s.jpg (3KB, 125x125px) Image search: [Google]
1305926326382s.jpg
3KB, 125x125px
is there a worse ide than visual studio? what load of bullshit
>>
>>60842857
If you notice, printf! is actually a macro, not a function. Learn what the differences are, C++ajeet
>>
>>60842856
The Rust COMMUNITY does, because one of its most prominent members is involved in antifa. But in terms of the actual language, I'm not seeing anything that pushes "diversity", except maybe the use of Unicode by default - and that's pretty much what modern languages SHOULD be doing anyway, C and C++ not doing so is excusable only because of their age.
>>
>>60842857
>8 bytes
>to store the length
lel

>>60842846
>not koding in electricity
>not leaving out the komputer komponent entirely as an unnecessary middleman and koding in ECL (electrical circuit language)
>>
>>60842857
>It does not work in a way consistent with other languages' print functions.
>baby duck syndrome
Just kill yourself dipshit
>>
>>60842884
It's the best.
But that's just because the others suck worse.
>>
>>60842893

>C++ sucks because Bjarne is an egotist
>Rust does not suck because 90% of the people who use it are cancerous ideologues
>>
File: 1476541970626.jpg (101KB, 901x1201px) Image search: [Google]
1476541970626.jpg
101KB, 901x1201px
>>60842901
Fuck off wintoddler
>>
>>60842907
C++ sucks because B*arne is a microsoft shill
>>
>>60842913
Make a suggestion.
>>
>>60842887
I KNOW it's a macro. But macro vs function should, 99% of the time, be an implementation detail. And println! does not conform to the behavior expected of a Java or C++ function.
>>
File: 1353837917007.png (3KB, 142x138px) Image search: [Google]
1353837917007.png
3KB, 142x138px
>>60842901
eclipse:
1. bring up the window with all the members, functions and shit
2. pick one and hit enter
3. it does everything for you

visual shit
1. bring up the window with all the members, functions and shit
2. pick one and hit enter
3. it jumps to the next line
>>
>>60842923
Spacemacs
>>
>>60842812
Are you that concerned about memory use at compile time? Because println! is a macro.
>>
>>60842907
not him but
>cancerous ideologues
kys trump shill
>>
New thread:

>>60837216
>>60837216
>>60837216
>>
>>60842931
Why do you want every language to be the same? Are you a communist?
>>
>>60842896
>>8 bytes
>>to store the length
>lel
Rust strings are stored as an array of chars and a size member using Rust's equivalent of size_t. Which is 8 bytes on a 64-bit computer. Which means a Rust string takes up a number of bytes equal to 8 + number of characters (assuming no multi-byte characters).
>>
>>60842936
What. You mean it doesn't store a string at all? Impressive. I'm wrong then.
>>
>>60842950

Clearly not if he's criticizing Rust.
>>
>>60842960
Looks like he is, why is this hypocrisy?
>>
>>60842932
>hit enter
So you're arguing that the default key bindings fit you better?
That's one way to judge software I guess.
For me eclipse didn't even render text properly (it had all kinds of FB issues that literally made text unreadable until restart).
And I know it doesn't inspect memory as well as VS.
>>
>>60842893
>except maybe the use of Unicode by default
Becaues of the colored emojis? Unicode by default is indeed a good thing.
Using Rust also means getting involved in the community one way or another. The official Rust book and documentation are written by Steve Klabnik. You cannot get around that guy.
>>
>>60842922
This
>>
>>60842870
Actually I was implying that about you. You got it backward.
>>60842947
That's the old thread, you absolute cunnilingusmonkey.
>>
>>60842900
>baby duck syndrome
If a language is designed to replace C++, yet requires a different program structure than C++, it's not likely to catch on.

>>60842907
>>C++ sucks because Bjarne is an egotist
I didn't say that though. C++ sucks because it's an ``OOP application language" with undefined behavior, uses incomprehensible and undecidable syntax, and has a bloated and poorly thought out standard library.

>>60842950
Languages should only be different from their predecessors when that difference is beneficial. But if a new syntax provides no actual benefit, all it does is requires programmers to do extra work.
>>
>>60842989
>So you're arguing that the default key bindings fit you better?
yes it does. it shows if the creator are some retarded idiots who never put a single thought into user-friendliness. the same goes for uis btw.
>>
>>60843013
If a languae is designed to replace C++ why should it act like C++?
>>
>>60843013
>hurr durr cater my baby duck syndrome because I am a brainlet
'no'
>>
>>60842960
Plenty of Communists criticize the USSR.

>>60842996
Nothing in the book ,at least what I've read so far, seems to indicate "mass immigration is good" or whatever the latest meme is.
>>
>>60843013
>poorly thought out standard library.
libraries*
>>
>>60843019
It should act like C++ in the areas where C++ got it right, and act different from C++ in the areas where C++ got it wrong.

>>60843028
This isn't about ``me". It's about the industry. People aren't going to go through radical changes unless it's clearly worth it.
>>
>>60843037
https://doc.rust-lang.org/1.2.0/book/dining-philosophers.html
fn main() {
let p1 = Philosopher::new("Judith Butler");
let p2 = Philosopher::new("Gilles Deleuze");
let p3 = Philosopher::new("Karl Marx");
let p4 = Philosopher::new("Emma Goldman");
let p5 = Philosopher::new("Michel Foucault");
}
>>
>>60843063
>C++ in the areas where C++ got it right,
like std::cout<<a++<<a++<<std::endl;

I SAY NO
>>
>>60843068
>those "philosophers"
not type safe
>>
>>60842771
if the position is important, use a normal for loop, for fuck's sake, why would you use a range-based loop if the index is important
>>
where the new thread, you sick fucks?
>>
I like how trumptards bring politics on every fucking thing when they run out of argument that have technological merits.
>>
>>60843068
>that list
holy fucking shit
>>
New thread: >>60843127
>>
>>60843105
/dpt/ is for single threaded programming only
we will make a second thread when this one dies
>>
>>60843111
Women had a large part in the invention of the general purpose computer.
Therefore, I think we should all give up programming. We're fighting for the bad guys.
>>
>>60843102
Why would you make it literally impossible when you have similar features for std::map?
It could be made free and good. But instead C++ decided on implementing it as a crappy feature instead of a good one.
>>
>>60843068
I don't see any reason to take offense to that unless you're so ridiculous as to insist that literally everything must be perfectly politically balanced. In which case you wouldn't be able to survive leaving the house.

>>60843075
I wasn't implying that nonsensical operating overloading was an area where "C++ got it right".
>>
>>60843140
Modern computer is invented by a faggot
>>
>>60843163
They could've given a number to each dining philosopher and called it a day. But no, they had to force diversity and communism.
>>
>>60843149
kill yourself
>>
>>60842959
I'm actually not sure about that. It should expand into io::_print(format_args!("{}/n",approximately_pi)) , but the format_args! macro is implemented as compiler magic and can potentially do anything below the hood.

The only thing you get to know is that it should return some object which implements the std::fmt::Arguments trait so that it can be fed into the lower level io::_print funtion, in order to optimize performance in cases where heap allocations can be avoided. There's no guarentee that it will always recognize those opportunities though.
>>
>>60843215
How can you proudly defend crappy features?
>>
>>60843191
>They could've given a number to each dining philosopher and called it a day.
That would be boring though.
>>
>>60843229
I see.
I don't see how the basic "{}" case wouldn't be caught if it can do that though.
>>
>>60843252
Or name them Jack, John, Sam etc...
You said that Rust is not influenced by the sickening ideology Steve Klabnik is part of. I proved you wrong. This is the first thing I found in the book though. I'm sure more lurks in there.
>>
>>60843285
I didn't say that Rust is totally free of influence from ``ideology", but your claim that it is ``forcing antifa ideology" is incredibly weak if the BEST evidence you can find of it is a code sample using the names of some leftist philosophers.
>>
>rust
>ever

https://github.com/rust-lang/rust/pull/25640
https://github.com/rust-lang/rust-buildbot/issues/2
https://github.com/rust-lang/rust/issues/28059
>>
>>60843307
The evidence is enough to prove my point. The language pushes extreme leftist ideology. Free Rust conference tickets for people with a diverse background and the code I posted.
>>
>>60843334
The third one is obviously a shitpost.
>>
>>60843373
>The language pushes extreme leftist ideology.
I disagree that the mentioning the names of leftist philosophers qualifies as "pushing extreme leftist ideology". Even saying "Marx was an important figure in the history of leftist thinking" isn't a far left idea, really you'd have to openly advocate the most extreme of Marx's ideas to be an "extreme leftist".

>Free Rust conference tickets for people with a diverse background and the code I posted.
Yet I'm sure you don't think there's any issue at all when decades go by without a single non-white or non-male speaker at conferences for other languages.
>>
Mentioning Karl Marx and those others in a programming book is just plain extreme leftist propaganda. Like I said before, any normal person would give them a number or give them a generic first name.
I only care about quality speakers. I don't care about their race, gender or political opinion. I only care about those who force their agenda on me.
>>
>>60843444
>Yet I'm sure you don't think there's any issue at all when decades go by without a single non-white or non-male speaker at conferences for other languages.
not him but I don't
>>
>>60843163
it would be ok to use famous ancient greek philosophers like socrates or someone like rene descartes but no they had to go full antifa with karl marx and his kike friends
>>
>>60843540
Talking like a neo-nazi isn't exactly helping your position.
>>
>>60843621
That's not me, I'm >>60843522
>>
>>60843639
Fair enough, but regardless, the response is valid towards the one who made the comment. I actually agreed with their post up until they started engaging in alt-right virtue signalling.
>>
>>60841167
havent tested, but heres my take on it
template<typename C, typename D, typename... Args>
auto make_resource(C c, D d, Args &&...args)
{
return std::make_unique<std::result_of_t<C(args...)>, decltype(d)>(c(std::forward<Args>(args)...), d);
}
>>
is Maki the official mascot of /g/?
>>
>>60843698
yes
>>
File: 1475460351002.jpg (88KB, 895x720px) Image search: [Google]
1475460351002.jpg
88KB, 895x720px
>>60843698
>>
>>60843522
How's that left propaganda? Like it or not, Karl Marx along with other economical thinkers is a well respected philosopher in our society despite connections to the left. Please go back to /pol/ where they care.
>>
>>60844093
it's a political statement which is completely out of place in a programming book
>>
>>60844093
Socrates is a much more popular philosopher than all others. I wonder why they didn't choose him...
>>
>>60843801

what human emotion does this facial expression try to convey?
>>
>>60844310
The need, the need for seed.
>>
>>60842856
>Pro diversity etc...
Pro diversity is the last concept that comes to mind with these people.
White hating, cis hating, man hating and generally going all out hate on anybody who doesnt share their regressive ideas.
>>
>>60844733
You're right, they use diversity as a cloak for white hatred. It doesn't matter if you're male or female, everything white is bad.
Thread posts: 371
Thread images: 23


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.