[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vr / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / asp / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / qst / sci / soc / sp / tg / toy / trv / tv / vp / wsg / wsr / x] [Settings] [Home]
Board
Settings Home
/g/ - Technology



Thread archived.
You cannot reply anymore.



File: xd6wmk6mz6201.png (66 KB, 854x382)
66 KB
66 KB PNG
What are you working on, /g/?

Previous thread: >>63720826
>>
>>63728905
Take your reddit meme and go back
>>
>>63728950
Still better than anime trap shit.
>>
>>63728905
First for sepples is the bestest
>>
>>63728905
I'm working on a remake of this(pic related) exasperating piece of trash in c & sdl.
Feel free(PLEASE) to see & criticise my code:
https://github.com/DevmanAuthor/Hinom_sdl

Who knew that programming a simple game could be so insanely difficult and time-consuming with crap I'm barely familiar programming with like "Renderers" and "Textures vs Surfaces". It's been months and I've like made 7 different sources & headers with a lot of code and barely jack to show for all my work. WHAT AM I DOING WRONG??!!!
>>
File: 1412742862372.png (629 KB, 674x752)
629 KB
629 KB PNG
The longer I work with the code at my job, the more and more a hate it.
If I had the time, I would rewrite this shit from scratch.
>>
Current state of windows 10:
"Come on update now, you don't wanna get some unwanted security breach right?"

after update:
"I don't care about your configuration, and all of the uninstalled unwanted bloatware. Let me reinstall all of that according to the great lord Microsoft. Also, all of the adware, and the data collector store has been reinstalled."
>>
File: 1484427271261.png (1.19 MB, 1127x1600)
1.19 MB
1.19 MB PNG
>>63729003
>If I had the time, I would rewrite this shit from scratch.
I imagine most people would.
>>
>>63729025
>Actually using windows
>>
File: 1489990296448.png (1.71 MB, 1058x1600)
1.71 MB
1.71 MB PNG
>>
File: 1374576513876.png (642 KB, 726x1040)
642 KB
642 KB PNG
>>63729030
Kill yourself, you degenerate fuck.
>>
>>63729037
Is having windows inside virtual machine just for /vg/ illegal?
>>
>>63729000
What is with the underscores in your commit messages? Are you a brainlet? Just use a string, or better yet, actually use the text editor to write a helpful commit message so that you know why you made a change so that when you go back in time to figure out why something exists, you can easily find out why with git blame. For commit messages, remember:
>50 characters on the first line, no periods
>blank line
>72 characters per line afterwards for deeper explanation
>>
>>63729062
>for /vg/
I guess not
>>
File: 1499318501665.jpg (1.67 MB, 1700x2470)
1.67 MB
1.67 MB JPG
>>63729000
Are you completely rebuilding or refactoring? The utils.h/c is giving me diarrhea.
>>
>>63729068
>underscores in my commits
I made function in bash to shoot my commits fast without typing git commit -m "commit whatever", but unfortunately it doesn't let me add spaces if I do that
>>
>>63729085
Wrap your arguments in "", idiot.
>>
File: 1443818149546.png (1.58 MB, 1200x1726)
1.58 MB
1.58 MB PNG
>>
>>63729085
Why do you have to be autistic? Just have better commit messages.
>>
>>
>>63728905
Can someone explain this picture to a foreign anon?
>>
>>63729104
The first says there is a single bug.
The second says there are multiple bugs.
>>
File: 1497335093747.png (890 KB, 1550x1123)
890 KB
890 KB PNG
That's it from me. Goodnight, fa/g/s.
>>
>>63729078
Assuming what I think you're saying, I completely rebuild the entire thing. Just look at build.sh
>>
>>63729104
found the bug : there is only 1 bug, and the person in action found it.

found a bug : there is unknown number of bug, and the person in action found one of them
>>
>>63729092
its easier.
>typing minimal on the command like
gcm "commit" saves more itty bitty fractions of my time instead of git commit -m "commit"
>>
>>63729131
>he doesn't use VSC where you just have to input the commit message, then send and push it taking a total of three binds
>>
Tell me your programming secrets, /dpt/

I'll start: despite working for a Microsoft centric corp as a .NET developer, I prefer Java and the JVM to C#. The core Java language is much simpler and enjoyable, it does not have feature bloat, the ecosystem is much bigger and the tools are better (IntelliJ vs Visual Studio). Java is like C while C# is like C++: bloat and terrible design decisions, just because they want to add new things every year to sell a new version of Visual Studio.
>>
>>63729104
instead of just literally explaining the words like an autist, here you go:

It's a joke implying that a junior dev is naive and upon seeing a problem in some program, he goes "I found the only bug, just have to fix it and everything works perfectly". The senior dev, relying on experience, doesn't make such an assumption and (realistically) expects more bugs to pop up later
>>
>>63728954
fuck off
>>
>>63729159
Can't imagine my brain on enterprise POO.
Glad i never fell for the uni and enterprise programmer traps.
>>
>>63729159
>Tell me your programming secrets, /dpt/

I never wear socks during programming
>>
>>63729104
First one had assignment that he successfully completed
Second one is just dude on the job
>>
>>63729159
So is your end goal is to try and create the worst opinion in the history of opinions?

JVM's great but ditch that archaic language. Use Scala or Kotlin and stop hating convenience.
>>
>>63729204
>Use Scala or Kotlin
hed be trading one kind of shit for another.
>>
>>63729186
>enterprise programming traps
But that's the best part of programming. Having real world problems, some of them involving money, into solutions and then into code.
>>
>>63729000
>WHAT AM I DOING WRONG??!!!
Probably overthinking shit. Also, if I were you, I would just use Allegro 4 or something. It's old, but definitely much comfier than SDL.
>>
>>63729159
Unironically this.
>Java is like C while C# is like C++: bloat and terrible design decisions, just because they want to add new things every year to sell a new version of Visual Studio.
This statement holds for shitlangs like Kotlin too.
>>
>>63729204
Nah Java is pretty good, no need to waste time learning another language. Time that is better spent doing actual work.
>>
>>63729159
I'm more intrested in languages than in the programs I could make in those languages - everything I needed to automate has already been done by somebody else.
>>
>>63729225
You can always focus on making compilers and interpreters if you like languages.
>>
>>63729131
>writes project in c -> super verobose
>has a script to write out his own commit messages

If you want, like text editor git commits you could probably save the raw text of the commit in a file and do a cat file redirect as you input commit message I've never tried though.
>>
>>63729216
Even if all problems would be solved, we feel this doesn't solve the riddles of life.

We are going into the wall at high speed.
>>
>>63729216
Unless you're lucky/invested enough to become a lead/manager. You'll constantly have to deal with sub-par commits and programmers. And you can't even choose a nice language to use, unless you're also lucky enough to be the CTO of a startup or something.
>>
>>63728905
junior dev: posting memes like OP posted
>>
is being called a 'dev' not degrading af?
>>
>>63729235
Not that guy, but i'd love that, but i don't think there are many jobs for compiler writers, unfortunately.
>>
>>63729235
Yeah, but when I come up with an idea I look it up and realize it's already been done in some language. I gave up when I learned about UFCS, before that I thought it was real fucking smart idea that nobody has thought of before.
>>
>>63729186
>enterprise POO
top kek

a little uni is good tho, you learn basic shit that's very much needed either way
>>
>>63729261
You need to study more languages then.
>>
>>63729273
I've already tried like 20 languages.
>>
>>63729267
afaik unis don't teach POO programming very well, you learn that while interning and shit
>>
>>63729284
And all 20 of them didn't have UFCS?
Amazing.
>>
>>63729261
>when I come up with an idea I look it up and realize it's already been done in some language
Doesn't really matter. Do you think something like C++ or Rust or D has an ounce of originality to it? If you want to create a programming language, just focus on filling some niche. This could be as simple as providing the correct combination of language features + some appropriate syntax sugar.
>>
>>63729296
Is there some language that did the BC before Rust?
>>
>>63729291
It turned out it was in D.
>>
File: 1499987566509.png (91 KB, 136x275)
91 KB
91 KB PNG
people who are willing to learn C++ really well can learn anything and not just programming related

they can become brain surgeons with less effort ffs

so why then learn C++ and not something really cool instead?
>>
>>63729309
Rust, Nim, D all have it.
C++ is supposed to be getting a fucked up version of it.
>>
What would you prefer as explicit kind notation?
T: [*, *] => *

or
T: [Type, Type] => Type
?
>>
>>63729315
Yeah, but I came up with the idea in 2013. Then I checked out D, that's where I learned the name for it from.
>>
>>63729000
Are you against using C++?
>>
>>63729307
>Is there some language that did the BC before Rust?
I don't know if any other language implements it exactly the same way as Rust, but restricting references to an object is not a new idea.
>>
>>63729312
"Yeah, I do sepples" is the best pickup line ever. Always works.
>>
>>63729315
Impl blocks are UFCS?

What's C++'s version going to look like?
>>
>>63729329
No one cares about one great feature if the rest of the language is trash. This is the biggest issue in Rust with its BC. Don't focus on trying to make the next world-shifting language, just focus on refining all the shit into a saner, enjoyable language. This is what D is doing and why i love it. But we're shifting towards functional programming. So figure out how to speed up type-checking and use RC'ing or something, so we can have comfy functional systems langs.
>>
>>63729333
>Are you against using C++?
Why the fuck would you suggest this productivity blackhole to someone who is already struggling to get anything done? His problem is not a language issue.
>>
>>63729361
>functional systems langs
Good luck trying to reason about the performance implications and the code generated by a pile of functional abstractions. Exercise for the reader: implement this efficiently in C++: map(f1, filter(p1, map(f2, filter(p2, coll))));
>>
>>63729413
I mean, C++ doesn't even have ranges, so UFCS is kinda pointless. Not because UFCS is bad, it's because C++ is not good enough for UFCS.
>>
>>63729361
> Don't focus on trying to make the next world-shifting language, just focus on refining all the shit into a saner, enjoyable language. This is what D is doing and why i love it.
This is why D is dead tho, by being the arithmetic average of C++ and Java/C#, it offers no sensible benefits over either of these.
>>63729413
>Good luck trying to reason about the performance implications and the code generated by a pile of functional abstractions.
Not a problem in a decent language.
> Exercise for the reader: implement this efficiently in C++: map(f1, filter(p1, map(f2, filter(p2, coll))));
Rust is pretty good at it, it even vectorizes the code: https://godbolt.org/g/gYuDnf . I don't think it would be a problem for C++ compiler either.
>>
>>63729131

git commit -m <<< cat commit_msg.txt

or if you to use your command

gcm <<< cat commit_msg.txt


I assumed you were talking about typing out the commit message string that part is the most grating.
>>
>>63729432
I think you got the wrong post number, anon. I wasn't talking about UFCS.
>>
>>63729452

Also you could do this as well to not worry about strings.

git commit -m <<< omg new message
>>
>>63729451
>Rust is pretty good at it, it even vectorizes the code
Where's the guarantee that `map(f1, filter(p1, map(f2, filter(p2, coll))))` won't take four passes?
>>
>>63729491
>Where's the guarantee
Where's the guarantee gcc's -O3 won't be identical to -O0? Do any optimizing compilers provide any hard guarantees?
>>
>>63729512
>Where's the guarantee gcc's -O3 won't be identical to -O0? Do any optimizing compilers provide any hard guarantees?
That was exactly my point. Good luck coming up with functional abstractions with SEMANTICS that guarantee a reasonable level of efficiency. Praying that the optimizer will do the right thing =/= understanding the performance implications of the abstractions you're piling up on top of eachother.
>>
Is there any way to group a method in C++?
for example I have this class
class foo{
std::vector<bar> data;
char check() {
if(score_a() > score_b()){
return 1;
}
return 0;
}
int score_a() {//calculate based on data}
int score_b() {//calculate based on data}
public:
void win(){
if(check()){
std::cout << "Player A wins\n";
} else {
std::cout << "Player B wins\n";
}
}
};

both score_a() and score_b() will not be used outside the check() function, so it would be really convenient, and reduce collision possibilities if it scoped to allow it only to be accessed by check() function. Is there any way to do that other than making another class object inside the check() just to calculate it, and passing the data to the object?
>>
>>63729526
When you're operating on iterators, then the operations are guaranteed to be lazy, so you can be sure that, for example, map doesn't return a whole new collection, but an iterator representing all elements of the underlying iterator applied to a function.
>>
>>63729333
I use c with g++
>>
Can anyone recommend a language to learn? I have a lot of free time and am looking to do something productive. Thanks.
>>
>>63729551
Look everybody at the worst kind of retard there is
>>
>>63729561
Learn Shen
>>
>>63729565
C/C++ people are mentally ill in general
>>
>>63729550
>When you're operating on iterators, then the operations are guaranteed to be lazy, so you can be sure that, for example, map doesn't return a whole new collection
`map` isn't the problem. The problems (for iterators, at least) crop up when some stage in your transformation is not one-to-tone. How does Rust solve that?
>>
>>63729580
I don't use rust much, but i guess, that if your iterator has the interface of next: Option<a>, then things like filter are not a problem either, since they can just skip some elements from underlying iterator until one satisfying the predicate is found or the end is reached. Things like flatmap might have to store some additional data if the function returns collections, but if it returns iterators too, then it shouldn't be too costy either.
>>
>>63729561
Java
>>
https://nibblestew.blogspot.com.au/2017/12/comparing-c-c-and-d-performance-with.html
>>
>>63729565
How is it retarded? Gcc standards are compitable with g++. Compiling it this way ensures compatibility when compiling with both gcc and g++ (in case anyone or I would ever need to)
>>
>>63729644
>he writes shitty C so he can compile it with sepples compiler
>>
>>63729654
>shitty c because g++
elaborate? Does compiling c code with g++ eventually force me to reduce the quality of c code I write? Then welp I'll need to revert to an earlier commit then
>>
>>63729608
>but i guess, that if your iterator has the interface of next: Option<a>, then things like filter are not a problem either
Sure, if you specialize your interface specifically to get around this problem. Now imagine a transformation that may duplicate some items. How are you going to fix your interface now? Vec<a>?
>>
File: d_ead.png (8 KB, 518x250)
8 KB
8 KB PNG
>>63729638
So it's even worse than I expected.
>>
>>63729696
>C
>+1000 memory leaks
kek I guess the memes are true after all
>>
>>63729689
>a transformation that may duplicate some items.
So flatmap (aka mapcat aka
(a -> [b]) -> [a] - [b]
).
It just has to next the underlying iterator, apply f to that element, store the result and keep yielding elements from that until it's exhausted, then repeat that for all elements from the iterator. It's mutable, sure, but you could just as well go next: Option<a, Self>
>>
>>63729689
> Now imagine a transformation that may duplicate some items. How are you going to fix your interface now? Vec<a>?
Iterators have states, so you can store the item in the state and return Some(item) two times, Repeat is the closest thing https://doc.rust-lang.org/src/core/iter/sources.rs.html#24-26 . Sure it could require some internal storage for non-trivial Iterator instances, but that would be more or less equivalent to doing the same task by hand.
>>
>>63729689
>>63729744
Oh, and by returning an option i mean, that it returns some when there's at least one element left and none when the iterator is exhausted.
>>
>>63729710
If the program is not meant to run for long time then it makes sense to not free the memory because operating system will claim it after the process is done.
>>
File: emojis.png (18 KB, 803x271)
18 KB
18 KB PNG
Meanwhile, apparently Rust team uses emojis in doc comments: https://doc.rust-lang.org/src/core/iter/sources.rs.html#50 . The future is here, guys.
>>
>>63729491
Laziness.
>>
>>63729759
>Explicit de-allocation calls
>79
>>
>>63729769
Their forum uses emoji too.
>>
>>63729769
The biggest meme language ever created.
>>
>>63729696
>1000 memory leaks
>0.004s runtime
What is the problem here?
And why not just use C++?
>>
>>63729788
How is that a problem? Comments are just arbitrary Unicode text. Emoji isn't valid in the actual code (except in strings of course).
>>
>>63729805
A language is supposed to be something used for work. Professional shit. Using little drawings no matter how Unicode they are just shows they are children playing with computers.
>>
>>63729823
>no fun allowed
>>
>>63729696
GDC is a shit compiler by the way.
LDC is the prime one people use for speed.
>>
>>63729828
You damn right, no fun allowed in my programming tools.
>>
>>63729793
>What is the problem here?
D is the problem.
>And why not just use C++?
Exactly.
>>
>>63729673
C++ restricts some C "features", like implicit int and implicit void* casts
>>
>>63729881
restrict pointer
>>
>>63729744
>>63729748
Sure, I suppose you could do that, but clearly you no longer gain the elegance and ease of implementation you get in an actual FP language (compare to implementing custom transformations for lazy collections), and I suspect the ability to optimize away the overhead also diminishes with the complexity of the internal state, so it's already not looking good for the most basic FP stuff.
>>
>>63729878
How would C++ be more productive than D in this project?
>>
>>63729131
>>63729085
Doesn't skipping the -m argument have the same effect as your bash shortcut? Just use a text editor.
>>
>>63729914
Rust recently added experimental support for generators (which will be upgraded to coroutines), which get rid of all the boilerplate of implementing iterators currently without changing how they are compiled.

I also don't know why you think there's overhead. It's fairly standard for iterator stuff to get inlined and aside from function calls there's nothing extra going on, it's all the exact same stuff you would need to implement the loop directly.
>>
>>63729914
> you no longer gain the elegance and ease of implementation you get in an actual FP language
Probably, but that's a problem for the author of the iterator in question, not for the user of the iterator.
> the ability to optimize away the overhead also diminishes with the complexity of the internal state
No, why should it? The compiler inlines everything and then optimizes it as if it's a manually written loop iteration. If the logic requires complex Iterator implementation, it would require complex traditional implementation as well.
> it's already not looking good for the most basic FP stuff.
What? "The most basic FP stuff" already works perfectly: https://godbolt.org/g/gYuDnf , the std lib implements the rest, and then there's itertools. Some advanced FP stuff could be slower than the basic functionality, but it still would be faster than say the equivalent stuff in Haskell, thanks for manual MM, stack allocation, inlining, unboxed values, and laziness everywhere.
>>
>>63729920
By being 20x times faster, so you don't have to waste weeks trying to optimize your code only to realize you've chosen the wrong language and have to rewrite everything in C++ anyway.
>>
Is there any reason not to do this?

    print(30 * '-' , 'MENU' , 30 * '-')
for item in sorted(menu.keys()):
print('[{}] {}'.format(item, menu[item]['name']))
print(67 * '-')
while True:
function = input('Choose a function [1-{}]: '.format(len(menu.keys())))

if function in menu.keys():
eval(menu[function]['function'])
else:
print('Invalid entry.')
>>
>>63729881
But it is a feature. The philosophy of C is it assumes the programmers knows what thery're doing.
>>
>>63729976
>Rust recently added experimental support for generators (which will be upgraded to coroutines), which get rid of all the boilerplate of implementing iterators currently without changing how they are compiled.
That would solve the problem, assuming it indeed compiles into efficient code.

>It's fairly standard for iterator stuff to get inlined and aside from function calls there's nothing extra going on, it's all the exact same stuff you would need to implement the loop directly.
That's your guess. Mine is different. I guess it's at least guaranteed that there won't be unnecessary passes, though.
>>
>>63729995
>[..] C [..] assumes the programmers know what they're doing.
Is this the costliest and the most damaging false assumption in the history of the industry? Because it looks like it is.
>>
>>63729920
The compile time is about the same for D and C++
The run time for C++ is about the same as C,
the D binary was ~20-25 times slower
The memory was properly handled in both C++ and D.
The C++ application was basically just a proper handling of the memory used in the C project.
What metric would you use to use as an argument for D?
>>
>>63730028
How so?
>>
>>63730032
https://twitter.com/CVEnew/
>>
>>63729993
wait, what language is this?
>>
>>63729945
Its in case I need to add arguments after the message. Yeah considering doing gcm < textfile but mine are really short
>>
>>63730039
python
>>
>>63729987
I don't think you understand, probably because you haven't worked in a professional environment. The "20x faster" you talk about is only saving >1 second in the runtime.

Furthermore you claimed
>"don't have to waste weeks trying to optimize your code"
Now this is very interesting. Which proves my theory that C/C++ programmers use C/C++ because they can't write efficient algorithms. They use it because they rely on GCC's black magic to turn their mediocre codebase into unicorns.

If you honestly believe real C++ programmers don't invest time on optimization, you should not be using C++ --may be C# or python is upto your pace.

Last but not the least the author said that he has not done any D project yet. Do not expect good D code out of him.

>>63730030
>The compile time is about the same for D and C++
If you read the article, he points out how it's GDC that wastes time in optimising the code. In my computer libphobos compiles very fast.
>D binary is 20 times slower
See above

>What metric would you use to use as an argument for D?
D is way more productive than C++ in practice. In fact, any language without stupid header file and C pre processor is more productive and less error prone inherently
>>
>>63729979
>that's a problem for the author of the iterator in question, not for the user of the iterator.
Sure, and if you're doing anything non-trivial, you're going to be an author of complex iterators sooner or later, which will instantly remind you that you are not dealing with a FP language. Other guy says Rust will have efficient generators, which would ameliorates this problem significantly.

>No, why should it? The compiler inlines everything and then optimizes it as if it's a manually written loop iteration.
That's your guess, not a guarantee. Either way, the goalpost was to ensure that no redundant passes are made, and it has been met, so I concede that point. Still, I wouldn't trust iterators in a performance-critical tight loop.

>Some advanced FP stuff could be slower than the basic functionality, but it still would be faster than say the equivalent stuff in Haskell
Being "faster than Haskell" doesn't cut it in systems programming, but then again, maybe someone will figure out advanced FP stuff with performance-friendly semantics. I just wouldn't count on it.
>>
>>63730028
>cargo build: error: misgendered u64
Yes. They clearly don't know what they're doing.
>>
>>63730015
>That's your guess.
https://rust.godbolt.org/
The default example compares a few kinds of loops/iteration. They're all compiled to the same thing.
>>
>>63730036
But any programming language has the potential to have security issues. It just so happens that C is extensively used in the low level space where security matters a lot. Also, a lot of bad programmers use C and don't know how to use it properly, just as there are a lot of good programmers who can use C well. Take for instance OpenBSD. It is one of the most secure operating systems, if not the most secure, despite being written almost entirely in C.
>>
File: 1509904596768.png (271 KB, 437x575)
271 KB
271 KB PNG
>>63729159
>Java
>enjoyable
>does not feature bloat
>>
>>63730028
>Is this the costliest and the most damaging false assumption in the history of the industry?
The false assumption isn't on the part of the language. It's on the part of the people who hire Rust-tier programmers like you to write C code.
>>
>>63730066
>Being "faster than Haskell" doesn't cut it in systems programming
It's also comparable to or faster than C++ depending on where you look.

>maybe someone will figure out advanced FP stuff with performance-friendly semantics. I just wouldn't count on it.
ATS is somewhat like that, it's just horribly ugly to the point of being unusable. Still valuable as a proof of concept.
>>
>>63730077
>anime pic
Do you expect me to take you seriously, kid?
>>
File: theo.jpg (17 KB, 152x166)
17 KB
17 KB JPG
https://marc.info/?l=openbsd-misc&m=151233345723889&w=2
>Rust fags blown the fuck out
Based theo
>>
>>63730074
Like I said, I see no guarantees here, only your assumptions. For all you know, the next version of the compiler will fail to perform some of these optimizations, or fail to perform some other "obvious" optimizations under some specific set of circumstances. It happens regularly. The most you can count of with a high degree of confidence is basic loop unrolling.
>>
File: 1512150604424.jpg (206 KB, 784x776)
206 KB
206 KB JPG
>>63730096
>ad-hominem
Wow, so mature. 4chan is an anime website, kiddo.
>>
>>63730107
So basically Theo is doing mental gymnastics around the fact that they don't support cross compilation.
>>
>>63730107
These retards are talking about Java, Lisp, and Haskell, not Rust.
>>
File: smug_laugh.png (330 KB, 782x1021)
330 KB
330 KB PNG
>>63730127
>being this butt hurt
Who's the one doing mental gymnastics now?
>>
>>63730063
You're making a good case for Python, m8. If the language performance doesn't matter, only algorithms do, why not rewrite the project in Python? It would be even faster to write than D, and much simpler to maintain.
> my theory that C/C++ programmers use C/C++ because they can't write efficient algorithms
Right, this is how C/C++/Rust manage to beat every other language performance-wise - by applying a lot of microoptimizations to O(2^n) algorithms the programmers come up with because they're so dumb, amirite?
>If you honestly believe real C++ programmers don't invest time on optimization, you should not be using C++
I'm actually a real-life C++ programmer, and we do spend a lot of time optimizing. That's my point tho - there's a hard limit you can reach with a hobbyist GC language like D performance-wise, and in many cases, it won't be enough. For example, if you're writing some high-performance servers, D being even 5x slower means you have to buy 5x more servers to achieve the same performance as C++, which adds up to a lot.
>>
>>63730134
Top quality argument
>>
>>63730139
https://marc.info/?l=openbsd-misc&m=151239514405129&w=2
https://marc.info/?l=openbsd-misc&m=151235215227096&w=2

And your's is much better? Stay delusional. Maybe the next time your mom lets you out of the basement she will let you go outside in a bubble. We wouldn't want you to catch a cold, would we?
>>
>>63730137
>D being even 5x slower means you have to buy 5x more servers to achieve the same performance as C++, which adds up to a lot.
D with LDC is more often than not faster than sepples, stop using benchmarks from a compiler no one but GNUtists in the community use.
>>
>>63730058
never use curly braces on python.
They hate that.
I'm surprised that script not UB yet.
>>
>>63730162
wow, he's able of posting something without an anime avatar! you okay over there mate?
>>
>>63730076
> one of the most secure operating systems, if not the most secure
* according to OpenBSD developers, because no one else cares about enough to waste money on an actual audit. Also, its level of security has been acheived despite using C, not because of it.
>>
>>63730173
curly braces are used by the .format function in python

https://docs.python.org/3.3/library/string.html
>>
>>63730132
>These retards are talking about Java, Lisp, and Haskell, not Rust.
His general points apply to Rust as well, my tardalicious friend. Also, it's mentioned explicitly:
>Such ecosystems come with incredible costs. For instance, rust cannot
even compile itself on i386 at present time because it exhausts the
address space.
>>
>>63730063
>The "20x faster" you talk about is only saving >1 second in the runtime
It was a small application, I agree.
Maybe it is less for a larger application.
>Which proves my theory that C/C++ programmers use C/C++ because they can't write efficient algorithms.
Don't know where you get that from.
This was a language comparison, not the skills of the programmers comparison.
I personally think the ability to write efficient code means there will be people who write efficient code.
>In my computer libphobos compiles very fast.
I didn't look into why c++ was slow to compile, I don't think compile time is that important.
>D is way more productive than C++ in practice
Why?
> any language without stupid header file and C pre processor is more productive
Header files are a good thing, I don't care about what you think.
C preprocessor replacements should not be needed, I agree, but it only hurts compile time.
>>
>>63730137
>You're making a good case for Python,
Congratulations, you just came to terms with the author. The author did pick D over Python though.
>> my theory that C/C++ programmers use C/C++ because they can't write efficient algorithms
Right, this is how C/C++/Rust manage to beat every other language performance-wise
There's nothing to be so defensive about. I know your type very well. You exclusively rely on your big daddy GCC to avoid being a laughingstock. Yet you desire the comfortableness of managed memory. What do you call that gimmick again? "Modern C++"? "Smart pointers"?
Don't delude yourself.
>n many cases, it won't be enough. For example, if you're writing some high-performance servers, D being even 5x slower means you have to buy 5x more servers to achieve the same performance as C++, which adds up to a lot.
Yet, Java utterly DOMINATES over C++ in serverside in terms of popularity. I wonder why?
Could it be that companies can't be bothered with malignant exploits? Less development time? I wonder...
>>
>>63730171
>D with LDC is more often than not faster than sepples
>I won't recognize any benchmark out there that says otherwise
>I won't provide benchmarks tho
>My position is basically that of an unfalsifiable belief
>Despite contradicting the common sense and decades of empirical observations of GC languages being slower than these with MMM
I see.
>>
>>63730209
Forgot picture
>>
hey guys, i'm trying to implement a patricia tree but i can't find good material online, can you guys recommend me some book or source? i'm not talking about code, i want the "theory" behind it, like how insertions are made
>>
>>63730137
>Right, this is how C/C++/Rust manage to beat every other language performance-wise
If you care about performance so much why not just stay with C?
https://github.com/kostya/benchmarks
>>
>>63730216
>arguing with roleplaying sepples fans
When will /dpt/ learn?
>>
>>63730209
> I know your type very well. You exclusively rely on your big daddy GCC to avoid being a laughingstock.
I don't get it, are you still implying C/C++/Rust programmer don't know their algorithms and rely exclusively on compiler optimizations to achieve the performance we enjoy? Can you be more delusional? Are you aware C++ is the first (and the only?) standardized language out there to explicitly specify the algorithmic complexity of stdlib's functions in the standard itself?
>>
>>63730254
>https://github.com/kostya/benchmarks
His sources are pretty bad.
Most people who do benchmarks of a million different languages rather than a few tend to skimp out on quality.
>>
>>63730278
>His sources are pretty bad.
Go make a pull request if you feel your language implementation isn't efficient
>>
>>63730254
>I like Rust because it's a good combination of performance and safety
>B-but if you like performance, why don't you stick with C?
>B-but if you like safety, why don't you use Coq?
Because I want to have both, how hard is it to understand?
>>
>>63730226
https://cs.stackexchange.com/questions/63048/what-is-the-difference-between-radix-trees-and-patricia-tries
https://stackoverflow.com/questions/14708134/what-is-the-difference-between-trie-and-radix-trie-data-structures
>>
>>63730269
I like how you forcefully append Rust to C/C++. Adorable.
>>63730287
>I like Rust
I don't. The language is unfinished and should not have published as v1, even at this point.
>>
>>63730287
>Because I want to have both,
Rust is not the solution then. D and Nim easily beats Rust in the benchmark.
>>
>>63730304
> The language is unfinished
Meaning exactly what? It's finished enough to be several times more widely used than 20yo D.
>>
>>63730318
*insert arbitrary reasons why i cant use those languages*
>>
>>63730322
>backed and funded by the second biggest browser company
>>
>>63730322
>It's finished enough to be several times more widely used than 20yo D.
That's because Mozilla has got a goodwill and unpaid shills promote the language more than they use.

Come back when you finally have a datetime library in your "systems language"
>>
>>63730338
And by datetime I mean a standardized datetime. None of that 3rd party pre pre alpha 0.x.y prototype garbage
>>
>>63730318
Why would I use a language with GC if I care about performance?
Why would I use a language with null if I care about safety?
>>63730337
>>63730338
>It's 'cause Mozilla
So what? It's still finished, relatively widely used, there's 15% probability you're running Rust code right now by using FF. What arguments do you have to call it "unfinished" tho?
> a datetime library
Here we go, this meme again, apparently https://crates.io/crates/chrono isn't real because reasons.
>>63730352
>moving goalposts
>>
>>63730338
>>63730352
kek
rust.into_iter().unwrap().map(|shill| shill = btfo.clone()).collect::<garbage<lang>>().unwrap().ok()
>>
Traps are essential to coding in every language.
>>
>>63730368
>Not wanting to use a pre pre alpha datetime library in the systems is now moving goalposts

>>63730368
>Why would I use a language with GC if I care about performance?
Because those langs beat your ass in multiple occasions in spite of having a GC
>>
>>63730368
>What arguments do you have to call it "unfinished" tho?
I'm not him, but for a language like Rust to enforce third party libraries because "muh std bloat" is pretty embarrassing. And it shows because i just watched a talk where some PR shill brags about having more "libraries" than haskell like that's supposed to be a good thing.
>>
>>63730391
Not just any library
The fucking datetime library

jesus christ
>>
>>63730294
these are good but doesn't help much because they don't create the tree and populate it by insertions... i can keep track logically the first 4 or 5 insertions but after that it becomes harder and harder
>>
>>63730389
>Because those langs beat your ass in 2 out of 10 microbenchmarks where GC haven't kicked in yet.
Right, can't wait to see D and Nim beating everybody on the benchmark game.
>>63730391
>>63730400
What's so special about datetime library it should be in the stdlib? C doesn't have one, neither did C++ until C++11, time_t being an ugly hack without any features. And where does it stop, should a language have GUI library in the std? DB access library? Network library(something Rust actually has in the stdlib)?

Also, there's exactly nothing wrong with third-party libraries when you have a tool like cargo to automatize everything.
>>
>>63730338
>Come back when you finally have a datetime library in your "systems language"
Why does a systems language need a standard datetime library?
>>
>>63730454
A systems language should have the tools to accomplish any task within a system.
Having a datetime library would fall under "essential tools".
>i'ts okay because these bad languages who everybody use as a guide on how not to do things did it
wow

And no a GUI lib is not mandatory nor essential.
>>
>>63730368
>Why would I use a language with GC if I care about performance?
>Why would I use a language with null if I care about safety?
Why would I use Rust if I care about writing non-fizzbuzz programs?
Why would I use Rust if I care about having a non-numale-friendly community?
>>
>>63730454
At least C has time.h. For a modern language that calls itself a systems language, not being aware of time is pretty fucking low.
>Networking in the stdlib
>No time library
Goes to show how unfinished the language is
>>63730485
As if you don't need timing functionality at all xDDDD
>>
>>63730495
Answer the question. Date/time stuff lies firmly within the application domain.
>>
>>63730485
How can you call a language a systems language if it has to rely on external libraries for making a file system? File systems need times.
>>
>>63730506
The FS just needs seconds since an epoch or something, and you don't want to unnecessarily standardize the epoch. Displaying the date/time of a file to the user is application level.
>>
>>63730506
>How can you call a language a systems language if it has to rely on external libraries for making a file system? File systems need times
If your Rust OS doesn't support keeping track of time, the user can't tell how slow it is.
>>
>>63730517
Keep making exceptions. Your gymnastics are making me chuckle genuinely.
>>
>>63730531
Nice argument.
>>
Rust and sepples shills shitting up another thread... and you just know these people have never written more than 100 lines of code. "System programmer" posers are the worst fucking cancer in this thread.
>>
Rust haters and their bullshit BTFO again: https://doc.rust-lang.org/std/time/index.html , Rust has more datetime functionality in the stdlib than C does. Now watch them moving the goalposts in the real time.
>>
>>63730535
>The irony of the post...
Pathetic. Go make an issue and ask for a standard datetime library. Even C has one and it's 3 decades old.
>>
>>63730548
Call me back when Rust can handle anything more complex than immutable trees "safely".
>>
>>63730548
>having more functionality than c is an achievement
is this an ironic shitpost m8?
>>
>>63730548
>Rust has more datetime functionality in the stdlib than C do
LOL
>>
>>63730565
rust.into_iter().unwrap().map(|shill| shill = btfo::from(utterly).clone()).collect::<garbage<lang>>().unwrap().ok()
>>
>>63730563
>>63730564
>>63730565
>Now watch them moving the goalposts in the real time.
>>
The anti-Rust shitposting in /dpt/ is getting more and more deranged every day. It's kind of entertaining, actually.
>>
>>63730586
>moving the goalposts in the real time.
no one did that though.
now give us a complete timestamp from the std
>>
>thanks for coming to the interview, anon
>we'll call you back when rust evolves beyond immutable trees
>in the meanwhile, i would advise you to learn c++ and apply somewhere else
What do?
>>
>>63730596
SystemTime
>>
>>63730586
>Rust has more datetime functionality in the stdlib than C do
See picture? How does it feel? Unfinished?

>>63730590
No, you rustfags are just as the problems as anti rustfags. But for you two, we would have less language shit smearing.
>>
>>63730586
>/dpt/ is one person
Sunshine, everybody hates your memelang. You need to go back.
>>
>>63730604
Nice screenshot you absolute spastic. Now look at the methods of the various types. There's plenty of functionality, more than enough to extract a human readable date and time if you're autistic and don't want to use the existing crate.
>>
>>63730604
> How does it feel? Unfinished?
No?
>>
>>63730618
>Still no date
Can Rust ever recover?
>>
>>63730636
Right after C.
>>
>>63730643
Can Rust ever recover?
struct tm {
int tm_sec; /* seconds, range 0 to 59 */
int tm_min; /* minutes, range 0 to 59 */
int tm_hour; /* hours, range 0 to 23 */
int tm_mday; /* day of the month, range 1 to 31 */
int tm_mon; /* month, range 0 to 11 */
int tm_year; /* The number of years since 1900 */
int tm_wday; /* day of the week, range 0 to 6 */
int tm_yday; /* day in the year, range 0 to 365 */
int tm_isdst; /* daylight saving time */
};
>>
>>63730618
>>63730643
>All these bloat
>Still manages to be less useful than <time.h>, especially tm
Nice memelang you got there, faggot.
>>
File: sure anon.png (249 KB, 390x379)
249 KB
249 KB PNG
>>63730659
>seconds, range 0 to 59
>int
>>
>>63730659
>seconds, range 0 to 59
Can C do anything right? https://en.wikipedia.org/wiki/Leap_second
>>
>>63730677
>>63730678
Rust permenantly BTFO
https://datacenter.iers.org/web/guest/eop/-/somos/5Rgv/latest/16
>>
File: swift.png (1.24 MB, 640x1136)
1.24 MB
1.24 MB PNG
Still working on this game

man... it's really does take a lot of time to develop games alone, I still have to record the musics, setup the audio, redraw the textures and write like 20 bosses behavior.
>>
>>63730697
i couldn't care less about rust but using a int for a range from 0 to 59 is retarded.
>>
Reposting, since the thread was dead when i posted this.
I've been thinking of a hybrid garbage-collected/raii language lately. You would have two separate heaps, one for collected objects and one for manually released/scoped ones. Both heaps would be traversed for roots, so manually managed objects could reference garbage-collected ones. Once a manually managed object is freed, any non-gc-heap references contained in it would be dropped too.
Am i missing some fatal flaw, or would it work?
>>
>muh performance
>>
I know or can learn pretty much any language, but I need to know what language will let me get the highest salary possible in the UK? Don't meme-reply with Arabic or Urdu please.
>>
why doesn't this compile rust friends

use std::time::{SystemTime};

fn main()
{
let now = SystemTime::now();
println!("{}", now);
}


>the trait bound `std::time::SystemTime: std::fmt::Display` is not satisfied

Shouldn't rust be "simple" and "easy to use"?
>>
>>63730733
सी#
>>
>>63730738
Because the actual representation depends on the operating system. If you want to print a human readable date and time, you can use the datetime crate. You could also print e.g. the number of seconds since the UNIX epoch by converting to a Duration.
>>
>>63730738
This is because Rust doesn't have inheritance and you have to manually turn on some traits before being able to use them
>>
>>63730738
it doesn't compile because making friends with rustaceans is a type error
>>
>>63730738
>doesn't know the language
>proceed to write in it anyway
>"Why doesn't it work?"
Every time.
>Shouldn't rust be "simple" and "easy to use"?
No? These were never the goals, you're confusing it with brainlet languages like C and Go.
>>
>>63730744
Whore
>>
>>63730764
>>63730752
meanwhile
void main() 
{
import std.stdio : writeln;
import std.datetime : Clock;

Clock.currTime.writeln;
}


And i was more asking a question and not shitposting, just curious.
>>
>>63730738
import System.Time (getClockTime)

main = do
now <- getClockTime
print now

Haskell
>>
>>63730775
>>63730778
Congrats.
>>
>>63730802
thanks

in the REPL it is normally sufficient to write
System.Time.getClockTime
>>
>>63730738
because rust is shit.
>>
>>63730775
>just curious
use std::time::{SystemTime, UNIX_EPOCH};

fn main()
{
let now = SystemTime::now();
// SystemTime implements Debug
println!("{:?}", now); // SystemTime { tv_sec: 1512655253, tv_nsec: 496882205 }
// To get time_t-like u64 value
println!("{}", now.duration_since(UNIX_EPOCH).unwrap().as_secs()); // 1512655253
}
>>
>>63730821
>
 println!("{:?}

rust sure is weird, thanks lad
>>
>>63730829
There's a difference between printing the representation of something for debugging and printing a user friendly, platform independent representation. SystemTime doesn't have the latter because otherwise it would be bloated.
>>
>>63730829
https://doc.rust-lang.org/std/fmt/ is a good read.
>rust sure is weird
Not if you compare it to printf or iostreams.
>>
>>63730840
>SystemTime doesn't have the latter because otherwise it would be bloated.
Why does Rust care so much about the dreaded "bloat" to sacrifice functionality? Seems pretty ridiculous.
>>
>>63730821
Meanwhile in Java 9 bundled REPL (jshell):

jshell> System.out.println(System.currentTimeMillis());
1512655614942


Why is Rust so verbose, /dpt/?
>>
>>63730852
Maybe because it's a systems language? It favours splitting things up into minimal components so that you only pay for what you need.
>>
>>63730860
Java is so concise
>>
>>63730860
>currentTimeMillis
Since when tho?
>>
File: slower.png (36 KB, 1201x259)
36 KB
36 KB PNG
I am somewhat confused as to why changing one little division causes a 3x speedup in this function.
The reason this function is so slow is because I push 50MP through it.
>>
>>63730890
Since I fucked your mom.
>>
File: slow.png (36 KB, 1195x259)
36 KB
36 KB PNG
Here you can see the fastly improved speed.
>>
>>63730906
>>63730921
Could the type deduction deduce different types of x?
>>
>>63730937
Now that you mention it. In the top example I first convert g to float64 and then do a vision on that. Afterwards I multiply the result.

In the bottom case I simply divide two integers and cast the result.

I'm still somewhat perplex in that this allows so much greater speed for the following calls.
>>
File: 1479883677181.jpg (143 KB, 833x696)
143 KB
143 KB JPG
>>63730908
>>
File: elon musk.jpg (97 KB, 648x838)
97 KB
97 KB JPG
>>63728905
I need an efficient algorithm to find even length paths on a graph, anyone?
>>
>>63730391
>more "libraries" than haskell
I used to like haskell, still kinda have a soft spot for it. But a ton of libraries were non-working or went into dependency hell when I tried them. You basically had to have every single project in a sandbox with the minimum dependencies. Also a lot of libraries were just mutually exclusive because of their dependencies version conflicts.

Using the language to jack off on /g/ like it's intended works just fine. But good luck trying to actually do anything with the language without getting into some kind of cyclic dependency hell
>>
>>63731004
My approach with functional langs is i'll use abstraction/sugar libraries. But anything of worth I implement myself.
>>
File: 1451682642698.gif (488 KB, 225x203)
488 KB
488 KB GIF
I know where the 3x speedup came from sadly.

obviously dividing a number like 0x3fff by 0xccc as integers won't give a very nice result
>>
File: Untitled.png (3 KB, 640x480)
3 KB
3 KB PNG
>>63728905
HolyC port.
>>
Why in C you need to prototype a function??
The linker able to link function from different file without any problem, so why the prototype is required?
//header.h
int getval();


c file:
//function.c
int getval(){ return 1}


main file:
//main.c
int main(){
printf("%d", getval());
return 0;
}

Why the function getval() should be declared beforehand in the header.h, otherwise main.c could not be compiled??
>>
File: 1482258825863.jpg (6 KB, 172x155)
6 KB
6 KB JPG
>mfw coworkers code style autism is no more with clang-format
>>
>>63731196
>Why in C you need to prototype a function??
Because C is an old and shitty language, ranjev. Pick literally any other one with modules.
>>
File: slightlyperformant.jpg (46 KB, 1185x214)
46 KB
46 KB JPG
Somewhat confused as to why Go's power function was that slow but I like my performance now.

10x speedup by manually writing my powers out.
>>
>>63731228
Now imagine you knew about loops.
>>
>>63731228
Because what you had before is floating point exponentiation. Integer exponentiation, what you're doing now, is much faster.
>>
>>63731248
I highly doubt this would improve my performance here.
>>
>>63731266
Not performance, but readability. I'm pretty sure that despite being a brainlet language, Go is able to unroll a loop with a known upper bound, so the resulting code would be equivalent. Plus you can have a variable with the current power of x and multiply it on every iteration, that would require 4 multiplications instead of 10.
>>
>>63731343
Not him but I really don't see how turning that into a couple of loops would be more readable. You might have a point if there were 10 components and not 5.
>>
Why the fuck does /dev/mem exist?
>>
>>63731380
Because *nix is an outdated shit.
>>
File: performant.jpg (45 KB, 1104x320)
45 KB
45 KB JPG
Exact same performance, worse readability if you ask me.
>>
>>63731380
I guess you could do some cool shit like dumping whole ram to a file, or grep for spmething in it. Pretty much useless outside of shell scripts.
>>
>>63731398
Even worse, I was missing a term in the looped version. It went from 900ms to 1000ms with the final term in there.

>When some internet expert thinks he is hot shit for being able to write a for loop
>>
>>63731398
>Plus you can have a variable with the current power of x and multiply it on every iteration, that would require 4 multiplications instead of 10.
That would get rid of the inner loop.
>>
>>63731398
>tfw you realize all the memes about Go programmers are true
var power := 1.0;
var termSum := 0.0;
for i := 0; i <= xfactors.len(); ++i {
termSum += xfactors[i] * power;
power *= power;
}
return uint32(termSum);
>>
>>63731433
Modern linux kernels don't allow you to read normal ram, only memory mapped devices.
>>
@63729159
Just use python, it's the most -bestest scripting language. Smh brainlets.
>>
>>63731448
> <=
I mean < ofc, .len() was an afterthought.
>>
>>63731448
Obviously.
The key point here is our programmers are Googlers, they’re not researchers. They’re typically, fairly young, fresh out of school, probably learned Java, maybe learned C or C++, probably learned Python. They’re not capable of understanding a brilliant language but we want to use them to build good software. So, the language that we give them has to be easy for them to understand and easy to adopt.
– Rob Pike 1


It must be familiar, roughly C-like. Programmers working at Google are early in their careers and are most familiar with procedural languages, particularly from the C family. The need to get programmers productive quickly in a new language means that the language cannot be too radical.
– Rob Pike 2
>>
File: graph.jpg (40 KB, 879x645)
40 KB
40 KB JPG
X isn't just a power, this code is incorrect
>>63731448

Is is mapped to this range
>>
>>63731502
Yeah, he used the wrong variable name but it's still equivalent code.
>>
>>63731502
Right, it should be
power *= x;

The point still stands tho.
>>
File: equal.jpg (54 KB, 1109x374)
54 KB
54 KB JPG
Ah good, back to equal performance for the looping variant.
>>
>>63731529
Never mind.
>>
>>63731560
It should be
termSum += xfactors[i] * power;
power *= x;

in the loop.
>>
File: comparison.jpg (343 KB, 2560x1369)
343 KB
343 KB JPG
The looping is a few percent faster, wasn't expecting this.

thanks /dpt/

>>63731587
Your version is shown here on the right, I am not sure if it is better than the one on the left.
>>
File: fullcomp.jpg (369 KB, 2560x1400)
369 KB
369 KB JPG
>>63731587
Ah you were right, good spot! bottom right in the original unrolled version.
>>
>>63728954
anime website
>>
>>63728954
trap website
>>
>>63728905
How difficult would it be to create a game like a text version of drug wars.
Assuming that would be my first project.
>>
convince me to try Rust without mentioning C or C++
>>
>>63731815
muh safety
>>
what is an ``FROB''?
>>
>>63731815
If you want to waste your time, it's even better than Lisp.
>>
>>63731815
It's got the best build system of any language bar Haskell.
>>
>>63731815
You can write a book while you compile
>>
In C++, I have a function that takes one argument:

func(void (*callback)())

How do I pass a member function as the callback to func?

Dog dog;
func(dog.bark);

Like this but in a way that actually works.
>>
>>63731924
whats so special about it?
>>
>>63731947
You have to pass it as a null pointer.
>>
>>63731947
>How do I pass a member function as the callback to func?
If C++11 or newer:
std::bind


Alternatively make a lambda that captures the instance.

If pre-C++11, you may need a functor (which requires rewriting the signature) or call a static member function.
>>
>>63731815
It has a good type system with nice properties without resorting to garbage collection.
>>
>>63731947
You should use std::function or template func over a callable type. Only use bare function pointers to implement something like std::function from the ground up or to interface with C.
>>
>>63731977
>>63732006
I can't change the signature of func, it's 3rd party. I'll take a look at bind, but this didn't work:

auto fp = std::bind(&Dog::bark, &dog);
func(fp);

(No suitable conversion exists.)
>>
>>63732069
In that case, you can't do it short of using a free function or lambda with no captures that uses a global to get the object.

Is that actually the signature for the function? Typically a C function that takes a callback will also take a void *data to be passed into the callback so it can act like a lambda with captures.
>>
>>63732103
Yes it's the actual signature. I assume it's because it's an old C thing.

I'll have to do the free function thing then. Sucks to have global state but what can you do.
>>
>>63732229
I'm sorry. Usually you can count on people to know what they're doing if they decide to write a library in C, but unfortunately that's not always the case.
>>
>>63729542
>Using a char to represent a bool
>Not using an enum when there's really three outcomes not two
enum GameResult{
WIN = 0, TIE, LOSE
};
class foo{
std::vector<bar> data;
GameResult check() {
//Calculate scoreA and scoreB
if(scoreA > scoreB){
return LOSE;
} else if(scoreA == scoreB){
return TIE;
} else {
return WIN;
}
}
/*
If it they're only used in check, just
move them into check
int score_a() {//calculate based on data}
int score_b() {//calculate based on data}
*/
public:
void win(){
switch(check()){
case WIN:
std::cout << "Player A wins\n";
break;
case LOSE:
std::cout << "Player B wins\n";
break;
case TIE:
std::cout << "Player A and B tied\n";
break;
case default:
std::cout << "Unexpected value returned from check()";
}
}
};
>>
>>63731248
Now imagine if he knew about recursion.
>>
>you can't have a vector of references in C++
>>
>>63731963
It's fast (the build system not the underlying compiler).
The Cargo.toml file spec has everything you need and is well defined.
Versioning and releases aren't an afterthought.
It's the only one in its own space and has a central repository in crates.io

I like using C++ more at the moment, but I just wish we had an equivalent to cargo and crates.io, Conan seems to be trying to do that but it's not in a usable state yet. Rust's package management story is just too good compared to messes like pip or maven.
>>
C++ is an abomination.

>>63732489
C++ references don't work like references you understand from other languages.
>>
>>63732500
So it's like every other modern language with a proper package manager?
>>
>>63728954
shit website
>>
>>63732503
At least it has raw pointers without """unsafe""" blocks.
>>
>>63732500
You can't have a decent package manager without a module system. C++ modules when?
>>
>>63732579
Why are you making this about Rust? Does Rust sucking make C++ less shit?
>>
>>63732611
Rust is not the only language that needs unsafe blocks or other markings to play with pointers.
>>
>>63732524
Essentially yes.
But how many modern languages have a PROPER package manager?
Hackage is the only one that i can think of that's as good as cargo.

Npm is a slowly improving pile of hacks.
Yarn is only incrementally better.
Pip is a piece of crap that doesn't handle common use cases.
Maven (like all the Java ones really) is overspecified enterprise bullshit where you need to write huge swaths of poorly documented xml to do anything.
>>
>>63732604
Learn cmake.
>>
>>63732637
D's dub is great.
>>
File: 1510588555122.jpg (15 KB, 388x341)
15 KB
15 KB JPG
>>63732604
they were pushed back to the next standard
>>
File: 1512500864910.jpg (167 KB, 576x1707)
167 KB
167 KB JPG
>>63732640
>CMake is a package manager
>>
>>63732648
No, Cmake lets you have modules.
You can find the packages yourself.
>>
New thread:
>>63732668
>>63732668
>>63732668
>>
>>63732640
Bloat. If it's not built into the language, it's shit.
>>63732647
I hope you mean C++20 by "next standard".
>>
>>63732661
CMake modules are not what modules are in most programming languages (what he was referring to).
>>
>>63732673
how is it different?
>>
>>63732627
Most of those languages aren't competing in the same domains as C++.
>>
>>63732640
writing findmodules is a pain in the ass tho, its beyond me how they made something so simple so annoying
>>
File: 1493049146555.png (371 KB, 832x868)
371 KB
371 KB PNG
I want to do an algorithms course now that my college classes ended, which online course should I take?

Also, is there a good way to self-study discrete mathematics for computer science?

Thanks.
>>
>>63732719
You tell where the files are located.
Even if you want to support different platforms, it can be written in 10 lines, most of which should be in a snippet.

I mean, learning cmake can be a pain and troubleshooting why your code isn't compiling can waste your time if you don't know what you are doing.
>>
>>63732661
>Cmake lets you have modules
Not in that sense.
>>
>>63732489
huh?
>>
>>63732980
>What did he mean by this?
>>
>>63732836
>Even if you want to support different platforms, it can be written in 10 lines, most of which should be in a snippet.
nah, ESPECIALLY if you are crazy enough to need support for:
- Debug/Release
- x64/32
>>
>>63732922
What are the difference?
A module is a part of a library, is that different in other languages?
>>
>>63733008
32 bit is deprecated, libraries should be tested individually, so having a debug mode is irrelevant in most cases.
But are you claiming that you cannot write a snippet that works good enough for 99% of all cases?
>>
File: 1490990725930.jpg (124 KB, 1024x1024)
124 KB
124 KB JPG
>>63733062
>32 bit is deprecated
>having a debug mode is irrelevant in most cases
>>
>>63733160
Yes.
It has been 15 years, stop trying to hold on to a deprecated cpu architecture nobody worth caring about uses.
>>
>>63732637
Scala's sbt is allright
>>
>>63729000
>https://github.com/DevmanAuthor/Hinom_sdl
>https://github.com/DevmanAuthor/Hinom_sdl/blob/master/system/sys.c#L4

Nigga what the fuck is this function why is all your indentation trash.
>>
>>63728954
shit off
>>
File: fp.png (49 KB, 644x412)
49 KB
49 KB PNG
Isn't this simply the most comfortable programming environment & language for Linux?




Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

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.