[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: 323
Thread images: 19

File: dpt_programming_club.png (890KB, 1550x1123px) Image search: [Google]
dpt_programming_club.png
890KB, 1550x1123px
Anime edition

Previous thread: >>60799997

What are you working on /g/?
>>
File: Calculus of Maki Constructions.png (312KB, 452x355px) Image search: [Google]
Calculus of Maki Constructions.png
312KB, 452x355px
>>
>>60804534
Lisp
>>
>>60804534
sometimes i feel lonely so i write some javascript that creates a promise that never returns

then i can say i made a promise to you, just like in my japanese animes
>>
>>60804534
What's the source on that manga?
>>
>>60804513
Is it normal to feel gross after using javascript?
The dynamic typing system just keeps rearing it's ugly head and idiomatic use of js is essentially chaining together multiple array prototype functions like
    return parseInt(num.toString().split("").sort().reverse().join(""));
>>
Ok, so I need to create multiple drop down lists for my webpage, but only after given how many I need in an input box. Just need some sample code or a link. I can't seem to find a good example anywhere.

I am using html/css/js
>>
>>60804625
Yes.
>>
Is it true that wearing a skirt will make me a better programmer?
>>
>>60804729
No. Learn Lisp.
>>
>>60804729
Test it and see
>>
Absolutely nothing.
>>
>>60804654
what the fuck are you talking about ニッが
even a child could manage that
<script>
var c = function() {
var d = document;
var e = d.getElementById('a').value;
while(e-->0) d.getElementById('x').appendChild(d.createElement('select'));
};
</script>
<div id='x'>
<input id='a' />
<button onclick='c()'>b</button>
</div>
>>
>>60804534
I've made my bot that streams a video game communicate with my IRC bot.
But I'm not feeling well enough right now to clean up the mess so I can actually make it robust.
>>
>>60804729
socks make a bigger impact
>>
 teamRepository.findAll().stream().map(Team::getName).sorted().collect(Collectors.toList()) 


Noob question
Can anyone explain me what each method does after the findAll() ?
>>
>>60804950
Anon you're betting people will know the context here.
Not a good bet.
Also I think you should look to your documentation for that.
>>
>>60804950
.stream() puts it in a different type like a stream or an enumerable or some shit (depends on the language)

.map(Team::getName) applies the function getName to each

.sorted() sorts the list
>>
>>60804973
Well it's in Java. The rest is pretty self-explanatory Well to be honest, I just don't understand what the map function does and what is a Stream.

>>60804996
Thanks anon.
>>
>>60804797
you da man
>>
>>60804507
what do you mean? I thought AI is going to replace literally every job over the next 25 years. Are you telling me that's B.S. Silicon Valley hype in order to get investmentbux?

I just want to know what hot field to go into to make all the hotbux while still having fun. Machine Learning seems really cool. Why am I wrong?
>>
>>60805126
Automation isn't AI
Advanced automation via a feedback loop "Machine Learning" isn't real AI.
>>
>>60805126
robotics is way behind ai so you can be assured menial labour jobs are safe
i recommend forestry
>>
>>60805142
so you really think Machine Learning is a meme and not worth my time?
>>
>>60805152
Machine learning isn't a meme but it is overhyped.
>>
This is how you generate numbers through a range in Python:
range(10)

and this is the same range, except in reverse:
range(9, -1, -1)

Notice something?
>>
>>60805165
>Notice something?
Python is shit?
>>
>>60805165
looks inconsistent as fuck, reasonable humans would type range(10).reverse()
>>
>>60805155
so do you think I should focus on software development principles instead of data science-y stuff.

AI, on the whole, really interest me. I think it'd be a lot of fun to work in Robotics.
>>
>>60805165
I noticed Python is trash. What else?
>>
>>60805178
takes twice as long.
>>
>>60805179
Do what you like. Both will have jobs available to you as long as you are competent.
>>
>>60805188
at least its readable, writing the shortest hardest to understand code possible is a sure sign of an edgy teen haxxor
>>
>>60804797
>ニッが

Dat mix of hiragana and katakana, it's like you're trying not to be 上級人種
>>
>>60805198
no, I mean it has to create the list, and then reverse it, instead of just creating the reversed list.

you're wasting precious milliseconds. If I ever saw someone do that I would slap them across the face.
>>
>>60805200
dude if i slap space and my ime doesnt get it right first time im not going back to correct it
>>
>>60805210
o well fair enough then
it still looks inconsistent, i dont know python but the first arg looks like the number of elements
youre saying the reverse version is the same yet you only specified 9
>>
>>60804797
>ニッが
Combined kana is vomit-worthy. Please stop.
>>
>>60805178
>AttributeError: 'range' object has no attribute 'reverse'
It only looks inconsistent if you don't understand start-stop, and steps. Why use anything other than a built-in?
>>
>>60805222
range takes aruments (start, end, increment)
start is inclusive, end is exclusive.
>>
>>60805165
that is weird.
In R the equivalent (because it is 1 indexed and I want to convert it to 0..9)
#assuming integers:
0:9
9:0
#but using the range:
seq(10)-1
seq(9,0,-1)
>>
guys what's the best meme-functional language in terms of fun, usefulness, and employability?

I'm leaning F# because .net but idk
>>
>>60805281
>meme, fun
>usefulness, employability
pick
>>
>>60805235
then the reverse would be
9,8,7,6,5,4,3,2,1,0
and original would take argument of.. either end exclusive or size and increment from 0
not sure, it doesnt feel right to have the end arg first in one and second in another, should totally just be
range(size) -> increments from 0
range(size, start, inc) -> adds inc to start until size number of elements created
>>
>>60805293
well it's not that way. You could do range(0, 10) or range(0,10,1) to accomplish the same way.

>>60805291
ok meme, fun. are there any hot new hipster functional languages with small communities that would be fun to learn?
>>
>>60805307
haskell!
>>
>>60805235
>start is inclusive, end is exclusive.
This is a retarded inconsistency.
for i = 1, 10 do print(i) end
for i = 10, 1, -1 do print(i) end
>>
>>60805307
f# sounds like a good one, i had a play but havent taken the time to really use it.. especially now netstandard is here and we can compile for linux without mono
>>
>>60805321
but haskell is old, grampa
>>
>>60805341
you can use recent GHC extensions
>>
>>60805307
range(0,10,1) resulting in 0..9 is not clear.
range(10) resulting in 0..9 is somewhat acceptable, but I would prefer require 2 arguments and then return a..y both numbers inclusive.
>>
>>60805326
Does this print 1..10?
In Python it's like the anon said, inclusive, exclusive, so to get 1..10:
[i for i in range(1, 11)] # From 1 (inclusive), stop before 11 (exclusive), step = 1
[i for i in range(10, 0, -1)] # From 10 (inclusive), stop before 0 (exclusive), step is negative

What is the inconsistency, besides Python being too hard for you?
>>
>>60805366
-> 《 >>60805326<< 》<-
>>
>>60805179
The thing about neural networks/machine learning is that the theoretical promises are very high and the practical reality is that it's very hard to attain something good.

I think NN will just be there for optimizing already established systems for quite a while before we start doing serious software using NN.
>>
>>60805371
One parameter is inclusive, the other is exclusive. This makes reversing unobvious as we've seen. Whatever. I guess it suits a 0-based indexing shitlang.
>>
>>60805371
>masking flaws with an iterator function
Nasty language goblins need to be exterminated.
>>
File: fox.png (335KB, 512x512px) Image search: [Google]
fox.png
335KB, 512x512px
>>60805390
>be brainlet
>blame the language
>>
>>60805390
>This makes reversing unobvious as we've seen
But I just posted how obvious it is. There's nothing to wrap your head around.
>0-based numbering
>bad
Imagine being this wrong.
>>
>>60805407
>Defend
1 == True
thon
>Not a brainlet
>>
>>60804596
>>60804534
Google and saucenao return nothing back.
>>
>>60805433
Bool are a subset of int. In an equality, 1 == True evaluates to True, because you test the value of each. However, 1 is not True, e.g.:
>>> 1 == True
True
>>> 1 is True
False
>>
>>60805458
>Bool are a subset of int
>>
File: 1446011544104.jpg (42KB, 539x539px) Image search: [Google]
1446011544104.jpg
42KB, 539x539px
>>60805458
>bool is an int
why tho, bool should be a bit
>>
>>60805468
>>60805469

0, 1 ∈ a
>>
>>60804534
Can someone explain the programming socks meme to me?
>>
>>60805469
They are, False == 0, True == 1
>>
>>60805469
>why tho, bool should be a bit
The smallest addressable unit of memory on most shit is a byte.
>>
>>60804570

I name all my global variables after past girlfriends
>>
>>60805493
heat (energy) leaves the body through extremities. Your head has hair on it, so the energy meets the hair (no conductivity) and heads back down. Usually, most of your energy leaves through your feet, because your socks conduct too much energy. If you have resistant programming socks, the energy will go to your head, see the hair and head down, go to your feet, see the socks and go back, and leave through your fingertips.

That way you have more energy in your fingertips, and are a better programmer.
>>
>>60805493
you tuck your nut sack in and that stops them from flopping about on the chair and accidentally sitting on them
>>
>>60805490
>0 and 1 are bools
>>
File: fear me.jpg (5KB, 110x100px) Image search: [Google]
fear me.jpg
5KB, 110x100px
>>60804534
am I good enough to start looking for a programming job yet? i've been practicing for 7 hours a day every day for the last 3 years. I been doing some research and apparently they ask questions in interviews to test your skills, I decided to give the one called "FizzBuzz" a try. Here's my implementation, please tell me if there's any way I could improve it. Also not exactly sure how you'd want fit the entire thing on a whiteboard, is it normal to just write first few lines to show you get the idea?

Print("1\n2\nFizz\n4\nBuzz\nFizz\n7\n8\nFizz\nBuzz\n11\nFizz\n13\n14\nFizzBuzz\n16\n17\nFizz\n19\nBuzz\nFizz\n22\n23\nFizz\nBuzz\n26\nFizz\n28\n29\nFizzBuzz\n31\n32\nFizz\n34\nBuzz\nFizz\n37
\n38\nFizz\nBuzz\n41\nFizz\n43\n44\nFizzBuzz\n46\n47
\nFizz\n49\nBuzz\nFizz\n52\n53\nFizz\nBuzz\n56\nFizz\n58\n59\nFizzBuzz\n61\n62\nFizz\n64\nBuzz\nFizz\n67\n68\nFizz\nBuzz\n71\nFizz\n73\n74\nFizzBuzz\n76\n77\nFizz\n79\nBuzz\nFizz\n82\n83\nFizz\nBuzz\n86\nFizz\n88\n89\nFizzBuzz\n91\n92\nFizz\n94\nBuzz\nFizz\n97\n98\nFizz\nBuzz")

>>
>>60805497
wouldnt a compiler (or in this case an interpreter) pack 8 bools to a byte?
seems like a pointless optimization to me but you never know, some knob is going to write a program that absolutely needs 10^20 bools in memory and complain that python isnt memory efficient
>>
>>60805536
not bad except the interview is on a windows computer which required \r\n for a break
>>
>>60805536

You need to iterate it to 450 and check for errors.
>>
File: give_me_a_break.png (577KB, 1372x767px) Image search: [Google]
give_me_a_break.png
577KB, 1372x767px
>>60805536
Try harder next time.
>>
>>60805539
> wouldnt a compiler (or in this case an interpreter) pack 8 bools to a byte?
No, it would be too slow to access them.
>>
>>60805539
>wouldnt a compiler (or in this case an interpreter) pack 8 bools to a byte?
No, it would be more memory efficient but it'd be less CPU efficient. I think that happens if you use vectors with bools in C++ though and there's a lot of issues caused by it.
>>
>>60805558

specialising vector<bool> was a retarded decision, they should have just made a separate std::bitvector or something
>>
>>60805539

It's legit twice as slow to access if not more.
>>
>>60805558
>>60805549
i guess, should be a processor instruction to pull a specific bit at an address.. when i write my compiler it's going to store bools as a long i swear
>>
>>60805579

>Each bit gets a unique address
fucking lol
just use a bitmask you moron
>>
>>60805579
>store bools as a long
Well, Win32's BOOL is defined as a full-sized int: https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx . For some reason, they also have BOOLEAN which is BYTE.
>>
>>60805606
MICROSOFT, ladies and gentoomen!
>>
>>60805589
no you dingus, still byte address but hardware bit level access so
cpb offset,0
would grab the first bit at offset
>>60805606
sasuga windows
>>
>>60805606
Wew, it looks like they also have VARIANT_BOOL : https://blogs.msdn.microsoft.com/oldnewthing/20041222-00/?p=36923 . WTF MS, get your shit together.
>>
>>60805643

so just combine your load instruction with a bitwise AND
>>
>>60805668
yeah.. oh well, there's no way around it, if you want to pack 8 bools in a byte you need to wait an extra cycle to read it
>>
>>60805536
I do coding interviews with new hires and I am going to say, this is probably one of the best implementation of Fizz Buzz I've seen. I would probably hire you on the spot if I saw that.
>>
>>60805548
what game is that?
>>
>>60805874

zelda wind waker
>>
>>60805874

▲ ▲
>>
>>60805887
are you sure? the hud, the aliasing, and the colors looks messed up. could it be one of those episodes released on the nintendo dual screen?
>>
>>60805914

You're looking at a 640x480 image stretched to 1372x767, of course it's gonna look like shit
As for the colours, it's probably dark because it's taking place during a storm
>>
File: 5eb.jpg (193KB, 1112x978px) Image search: [Google]
5eb.jpg
193KB, 1112x978px
https://www.youtube.com/watch?v=lO1z-7cuRYI&feature=youtu.be
>>
>>60805950

I'll tell you what I think an hour from now.
>>
>>60805957
But when will you tell us?
>>
File: bleh.png (207KB, 640x480px) Image search: [Google]
bleh.png
207KB, 640x480px
>>60805914
>>
>>60805950
that introducer is CUTE
>>
>>60805950
>you can just use this iterator and it gives you Parallelism!!!
No. Fuck off with that shit. That's for apes. If you care about performance you can't do things like this. You will be slow. If you don't care, well I suppose you might gain something from it? A better program in an aspect you don't care about.
>>
>>60805946
>>60806002
if you say so... how did you take that screenshot? are you playing on an emulator?
>>
>>60805950
>First they ignore
>Then they laugh
>Then they fight
>Then they join
Nice to see sepples fags finally acknowledging the challenge that Rust poses, who knows maybe C++ can learn owenership and borrowing from Rust.

I don't trust Bjarne though, he's a fucking windows shill.
>>
>>60804534
is there any difference between Character array and String in java?
>>
>>60806437

char[] is mutable, String is not. StringBuffer is mutable too, not sure why that exists
>>
>>60806449
but how about Character[]?
>>
>>60806455
boxed
>>
>>60806455

learn what boxed primitives are
learn yet another reason why java sucks
>>
>>60806301
> That's for apes.You will be slow.
How much do you know about Data Parallelism? It's a well-tested concept, implemented in OMP and Parallel Fortran decades ago, it has been recently added to C++17 as Parallel STL, and these things are very fast. I guess you assumed they're gonna create a new OS thread for each element in the collection, but that's no how it works: https://github.com/nikomatsakis/rayon#how-it-works-work-stealing .
>>
Give me something to program.
>>
>>60806574
Rewrite grep
>>
D fag here. I am feeling greatly demotivated :^(
I want to use Qt with Qt-creator but I don't want to use C++ because it's so shitty.

Is creating apps using Gtk manually my only option?
>>
>>60806633
>D fag
>:^(
>apps
g8 b8, m8
>>
>>60806633
gtk as glade

https://glade.gnome.org/

the layout is exported as a xml file and then loaded dynamically by the gtk application. this technique is know as data-driven, it make the designer independent of any programming language. hard to believe Qt hasn't the same thing.
>>
>>60806633

C++ > D prove me wrong
>>
>>60806690
M O D U L E S
M O D U L E
M O D U L
M O D U
M O D
M O
M
>>
>>60806695

soon
>>
>>60806704
Just wait™
>>
>>60806356
That's just some photoshop to reverse the image scaling.
>>
>>60806704
if by "soon" you mean a decade
>>
>>60806690
C++14* > D
>>
>>60806695
They're literally in MSVC right now.
>>
>>60806690
garbage collection.
>>
>>60806727

It was already better by C++11
>>
>>60806729
Also in clang what's your point?

>>60806739
C++ has garbage collection as well
>>
>>60806749
>C++ has garbage collection as well
prove it
>>
>>60806739

>Garbage collection is good
>>
>>60806727
>>60806740
C++<something> doesn't sprinkle unicorn tears on top of the pile of shit C++ already is (by design)
>>
>>60806754
https://github.com/ivmai/bdwgc
>>
>>60806749
>Also in clang what's your point?
Also in MSVC, what's your point?
>C++ has garbage collection as well
Yeah but the creators weren't insane enough to enable it by default.
>>
>>60806759
Ability to choose between GC and non-GC is pretty good imho
>>
>>60806759
any sane programmer will tell you that garbage collection is great.
>>
>>60806779
>what's your point?
C++ is a non-standard piece of shit
>>
>>60806794
Modules are just going to be the new pragmas where every compiler in the world supports it but it still won't be standardized.
>>
>>60806729
>Micros**t C(++)
time to move to Rust then
>>
>>60806690
Well, >>60806804 just proved you wrong. Enjoy your 12 standard libraries and 72 different module systems
>>
>>60806780

If it really is optional, that's fine.
In reality you can't use the standard library without intentionally leaking memory.
>>
>How to spot a shit language 101:
Variables are defined like this:
int x (1);

Top kek, dropped in the spot
>>
>>60806833
What language does that?
>>
>>60806793

the only people who need GC are retards who can't scope their objects or functional autists
>>
>>60806840
C++17
>>
>>60806822
>having choice
Oh nooooooo, how will I manage? Seriously, too many choices is a much better problem to have than being forced to use a GC.
>inb4 you pretend disabling it doesn't break fucking everything
>>
>>60806833
>>60806849
lel, and here I was thinking about giving sepples a try. gg
>>
>>60806833

>Doing things the retarded way on purpose
>>
>>60806845
>scope your objects
>concurrent computing

manifestly, you don't know anything about today programming.
>>
>>60806864
Tell that to the windows shill called B*arne
>>
>>60806871

Bjarne would tell you to do
int i{12};
anyway
it's cancerous, if only C++ had modules instead of function prototype header bullshit we could have a truly unified initialization syntax.
>>
>>60806850
>having choice
Apperently C++ is meant for Microsoft Windows™. Can't wait to install windows 10 and do the needful
>>
>>60806849
Actually, the recommended way to do this in C++17 is
int x {1};
>>
>>60806833
what your problem with that?
>>
>>60804534
/dpt/ - Daily Pajeetting Thread
>>
>>60806906
What the hell are you talking about?
>>
>>60806915

anon doesn't realize that clang has modules too
>>
>>60806898
>>60806910
>3 (THREE) ways of defining a fucking variable
int x = 1;
int x (1);
int x {1};

AHAHAHAHAHAHAHAHAHAHA sepples neverever
>>
>>60806928
Even your shit++ bible requires that you are using windows, nigger
>>
>>60804534
/dpt/ - Daily Pooinloo Thread

Pajeets here share their poo made in loo.
>>
>>60806942
>GCC
>clang
>windows
Anon, I'm sorry but you're retarded.
>>
>>60806934
It actually reflects the fact that C++ has 3 standard libraries
>>
File: Windows shilling book.jpg (9KB, 216x233px) Image search: [Google]
Windows shilling book.jpg
9KB, 216x233px
>>60806949
Re read my comment you dumb fuck nigger
>>
>>60806951
kek
>>
>>60806951
Shouldn't it be named C+++ in that case?
>>
>>60806959
idk wtf ur on but that's not the C++ bible
Here's a link to it if you're interested in learning a useful language
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md
>>
File: 1406803019377.jpg (103KB, 1280x720px) Image search: [Google]
1406803019377.jpg
103KB, 1280x720px
>>60806833
#include <iostream>

class shit {
public:
shit();
};

class crap {
public:
crap(shit &c) {
std::cout << "Constructed crap using shit" << std::endl;
}
};

int main()
{
crap foobar(shit());
}

Without running this, try to reason about what the output of this program is.
Then confirm it.
>>
>>60806804
You do realize what you are saying, right? You do realize you are looking at compiler specific non-standard codebase, right?
>>
>>60806975
>but that's not the C++ bible
>LITERALLY WRITTEN BY WINDOWS SHILL HIMSELF
>>
>>60806934
You forgot
auto x = 1;
auto x(1);
auto x{1};
decltype(auto) x = 1;
decltype(auto) x(1);
decltype(auto) x{1};

All these define x as int with value 1;
>>
>>60806983
>class
Stopped reading right there
>>
>>60806983

You realise this {} initialization was added right?
There's zero reason to use () or = any more.
>>
>>60806983
>endl
Dropped. Where do you guys even learn these shit habits?
>>
>>60806996
Disgusting. Now I see why sepples never could be successful for what it was intended to be
>>
>>60806996

what's the reason for using decltype
>>
>>60806999
Yes, I know it's fucking garbage.
Run the program and see how garbage it really is.
>>
>>60806983
Nothing, right?
Since the constructed shit is an rvalue, and the crap constructor clearly takes an lvalue.

Too lazy to confirm.
>>
>>60807000
>There's zero reason to use () or = any more.
*p (1);
*(p+1) {12};
not working
>>
>>60807013
Determine the declaration type of a variable, similar to C11's _Generic macro
>>
>>60807024

>Initialization is the same as assignment
Oh no, it's retarded.
>>
>>60807013
There's none in this case, but in
int a = 1;
int& b = a;
auto c = b;
decltype(auto) d = b;
c is gonna be int and d - int&.
>>
>>60807029
>'=' has no reason to be used anymore
Let's see your beckpedal strategy
>>
>>60807047

in the context of fucking initialization, of course it has to be used for assignment

You're retarded if you thought I meant that = was never to be used anywhere in the language.
>>
>>60807029
I think he means construction specifically
>>
>>60807047
There is a reason to use =, namely for assignment.

int a{1};
int b{2};

a = b; // only possible through assignment
>>
>>60807059
>just because I said it doesn't imply I meant so
Oh look it's another C++ cuck in damage control mode
>>
The more I read this thread the more I learn how shitty C++ is
>>
>>60807087
>"learning" from /g/
kek
>>
>>60807087
The people who constantly give C++ shit aren't memeing.
It's actually fucking garbage.
>>
>>60807089
I'll definitely avoid languages that force compiler lock-in. It defeats the purpose of having multiple choices.
>>
>>60807087
Don't listen to them. The people you see on /g/ shitting on languages spend all their time shitposting instead of actually programming anything.
>>
>>60807102
Yet there has not been a single complaint about the language that wasn't a meme.
>>
DO

NOT

OPTIMIZE

Make your program, only ever optimize when performance is insufficient.
>>
>>60807117
>true complaints aren't real complaints because they're "memes"
>>
>>60807114
Even people outside /g/ who "actually program" discourage C++. And I will bet those people I'm referring to know what they are talking about.
>>
>>60807117
>every complaint is a meme
>C++ is perfect
>>
>>60807111
>C++
>compiler lock-in

What the hell are you talking about? icc, gcc, clang, mvsc, all support C++. There are even more out there.
>>
File: leavecalone.jpg (12KB, 316x316px) Image search: [Google]
leavecalone.jpg
12KB, 316x316px
don't bully c++
>>
>>60807126
>>60807129
>hurr durr I think initialization lists are ugly bugly
>not a meme
>>
>>60807111
What compiled languages besides C and C++ have more than one supported compiler tho?
>>
>>60807125
>being forced to rewrite entire program because you never bothered with refactoring and optimizing as you went along
nope
>>
>>60807125
GCC -Ofast

Fuck u
>>
>>60807126
>two ways to initialize
>two libraries give you the same functionality
How is this not memes?
>>
>>60807134
Well you got non-standard modules, haven't you? And you pretty much said the non-standard modules will grow by themselves as time goes on. So you got 5 potential compilers having 5 different module systems.

It's not just another library, anon. Modules are a core feature of a language. Having a core feature non-standardized for a 30 year old language is not really inspiring.
>>
>>60807117

There are tons of reasons to dislike C++.
Modules are nonexistent and headers are bullshit, especially if you want to make the most of templating. Variable declaration and initialization is a mess because it inherits C's declarator and function prototype retardation.
If there were a language exactly like C++ but with the legacy stuff removed and the rest cleaned up, I'd love it.
>>
>>60807125
You're fucking stupid. Performance should always be in mind from the start.
Always think about how your program is accessing the cache: it's much harder to change later.
>>
>>60807149
Java, C#, Ada, Fortran, Haskell, ...
>>
>>60807144>>60807167

His complaint is the number of redundant syntax that has just built up over time due to C++'s shitty committee
>>
>>60807149
Does it matter? C++ lost the blessing of having multiple compilers by having non standard core features
>>
>>60807164
>not using -march=native -O3 --ffast-math
>>
>>60807167
>two
3 ways*
>>
>>60807170
>Well you got non-standard modules, haven't you?
What non-standard modules?

>Modules are a core feature of a language
C++ doesn't have modules...
>>
>>60807125
It's not that black and white at all
>>
>>60807190
>C++ doesn't have modules
According to your fellow sepples fag "It's literally on your preferred OS-only compiler" right now
>>
>>60807156
>>60807174
>>60807192
And you'll never get a job. Performance can be fixed later, bad program design can not be. Whether your int64 could be an int32 is worse than useless to think about, it actively hinders your development speed and might even introduce bugs later on when your optimization assumptions backfire.
>>
>>60807177
>Java, C#
Are they? All C# compilers are based on Roslyn, I know nothing about Java tho.
>Ada
GADT is the only alive, IIRC.
>Frotran
I know about Intel's, but is the one in gcc alive?
>Haskell
Lol no, GHC had killed everything else years ago.
>>
>How to spot a shitty language
>Shitty, redundant core design
>Unsuccessful for over 3 decades
>Reference book written for wincucks
Trash
>>
>>60807199
Again, C++ doesn't have modules. Are you confusing modules with libraries?
>>
>>60807199

>being this willingly ignorant
You already got told Clang had it.
>>
>>60807216
>>60807217
So which one? Does C++ not have modules or Microsoft C++ compiler implements modules in C++?
>>
>>60807211
>Are they? All C# compilers are based on Roslyn
Well, you have mono and whatever Microsoft call their own compiler.

>I know nothing about Java tho.
You have the reference compiler (Oracle's), but there's also OpenJDK, GCC etc.

>I know about Intel's, but is the one in gcc alive?
It's alive enough to still work at least.

>Lol no, GHC had killed everything else years ago.
Anyway, plenty of languages have multiple implementations.
>>
>>60807172
header files are great what are you talking about?
Variable declaration is fine, you have some options which is good.

>>60807180
All programming languages have redundancy.
oh, no, you can use for, while and do while in the same language?
You have if, ? and switch in the same language?
How will people ever know how to write a function?
Nobody sees this as an issue.
It is a meme to bitch about trivial things.
>>
>>60807204
Already got a job.

>Performance can be fixed later, bad program design can not be
what does design have to do with optimizing.

>Whether your int64 could be an int32 is worse than useless to think about
That's pre-optimization
>>
>>60807227

The language does not specify support for modules. Several compilers, including free cross-pllatform compilers, implement modules systems.
>>
>>60807227
>So which one?
None of these posts said anything about C++ having modules. Your reading comprehension is really bad, are you an indian?
>>
>>60807246
>The language does not specify support for modules.
Progress. Now the other anon suggests that there will never be any modules. Which is a sad drawback if you ask me. Writing header files is fundamentally inefficient
>>
>>60807263
>Now the other anon suggests that there will never be any modules.
Correct.

>Which is a sad drawback if you ask me.
Correct.

>Writing header files is fundamentally inefficient
Correct. Blame the committee for being a bunch of retards.
>>
>>60807243

Why would you ever want to use header files instead of having a modules system?

There is near-zero advantage to having 3 different declaration syntaxes.
int foo = 1, int foo(1) and int foo{1} all do the same thing, and the moments where the = and () styles are very rare.
>>
>>60807243
Are you seriously comparing if/switch/? to >>60806996
>>
>>60805447
https://dynasty-scans.com/series/hatsu_kokuhaku

You really this bad, /g/?
>>
>>60807280
And people wonder why C++ failed to reach its goal
>>
>>60807274
>int foo = 1, int foo(1) and int foo{1} all do the same thing
They do for integers, they don't for compound or composite types.
>>
>>60807204
>Performance can be fixed later
Not if it's a fundamentally design flaw of your program.
Have fun writing your python "programs".
>>
>>60807296

What goal might that be?
>>
Programming challenge from yesterday: using you're favorite language, write a code segment to make and print a cyclical list

An example in C
struct list {
int cell;
struct list *next;
};

int main(){
struct list head;
head.cell = 9;
head->next = &head;
struct list *current = &head;
while(current){
printf("%d\n", current->cell);
current = current->next;
}
return 0;
}
>>
>>60807345
Replacing C
>>
>>60807303
Performance will rarely ever be a fundamental design flaw. Poor decisions will be. Which is why you can't be a bad programmer.
>>
>>60807364

It's not like C has a shortage of questionable design decisions.
>>
>>60807274
>>60807280
int is a trivial example, nobody cares if they extend the functionality so it works everywhere.

myclass a = other_class;
myclass b(variables);
myclass c {var, var, var};

Is a more real example.
The first will create the class with an empty constructor, then use a copy constructor.
The second example will take variables and construct the class.
The last will do the same, but might be better or worse in some cases. A vector of variables or something would be very useful.

There is no confusion about this, hence why it is a meme.

For class initialization, you need to use the initialization.
myclass::myclass(int a) :
b(a)
{
}
>>
>>60807364
http://githut.info/
>>
>>60807388
And yet C++ failed, it had 40 years to do so
>>
File: 1491081808903.jpg (56KB, 945x482px) Image search: [Google]
1491081808903.jpg
56KB, 945x482px
>>60807398
Sure proved me wrong there anon wow here is my dank meme rate
>>
>>60807393

>The first will create the class with an empty constructor, then use a copy constructor.
wat? I don't see another instance of my_class to copy construct a from.
>>
>>60807364
I don't think C++ was ever expected to supercede C. C and C++ live alongside each other, and both serve different purposes.

>>60807398
This is a terrible way to measure what languages and technologies are actually used. This shows what language is most popular among github users, but afaik most github users aren't working in an embedded space or an enterprise space. Also how the fuck are they measuring popularity? Number of repos? Because a dozen pad-left.js projects doesn't really mean much.
>>
>>60807417
You got that for 2017? Your chart really isn't making a good point for C.
>>
File: C++.png (40KB, 1620x774px) Image search: [Google]
C++.png
40KB, 1620x774px
>>60807433

C++ was definitely intended to replace C.
It failed but it has a purpose of its own.
>>
>>60807433
>I don't think C++ was ever expected to supercede C
On a particular interview where B*arne was asked if C is needed any more, he said "no"
>>
>>60807436
And also for C++
>>
>>60807451
>>60807456
I looked up the interview, and that's surprising. I'd say that's more indicative of Bjarnes foolishness and pride than of failings of C++
>>
C++ is a wincuck language, it's written for winfags, taught on windows and just like windows, the core language is a massive pile of shit
>>
>>60807494
The creator of your language is an idiot, a literally-who illiterate faggot who had 0 idea of compiler engineering
>>
>>60807355
python:
from itertools import cycle
for i in cycle([9]):
print(i)
>>
>>60807513
I don't really use C++. I use C for most of my work these days (embedded dev), and I use Scheme when I want some mental masturbation
>>
C++ is such a shit language. Look at how many different ways there are to add two integers:

a + b
b + a
a + b * 1
a + 1 * b
b + a * 1
b + 1 * a
a + b + 0
b + a + 0
a + 0 + b
0 + a + b


What a shitty design.
>>
>>60807545

for (int i = b; i > 0; i--)
a++;

shit language
>>
Why does gcc only give me some warnings when I'm building with optimizations on?

For example:
gcc -c -g -std=gnu99 -Wall -DEBUG -o main.o main.c 

Produces no warnings.

Then I build the same project with:
gcc -c -O3 -std=gnu99 -Wall -o main.o main.c 

This produces five warnings about possible uninitialized variables.

I guess I'm giving the options in the wrong order or something but how?
>>
>>60807545
int x (1)
int x (1)
int x {1}

kek C++ dropped
>>
>>60807355
int main()
{
void *ptr = &ptr;
}
>>
I posted this question yesterday with no answer. I've rewritten it to make it more clear as to what exactly I want to do. Hopefully any of you are smart enough to think of a solution.

I have 10 objects. Each object can be in 3 states, 1, 2, or 3. Let's take the outcome 1111111111. For that one outcome (or any other), I am trying to loop through all the ways one can get 8 out of 10 guesses correct for it. For example, 2111211111 would be one of them. I've managed to get this to work with 9/10 with the loop below, but I need help for getting it to work with 8/10 and 7/10 as well.

For simplicity, let's assume the only combination we're ever checking is 1111111111.

  Dim incorrectcombos As New Text.StringBuilder
For i = 2 To 3
For j = 0 To 9
Dim combo As New Text.StringBuilder
For k = 0 To 9
If k = j Then
combo.Append(i)
Else
combo.Append(1)
End If
Next
incorrectcombos.AppendLine(combo.ToString)
Next
Next
MessageBox.Show(incorrectcombos.ToString)
>>
>>60807604
I am actually officially going to avoid C++ now, thanks to todays /dpt/
>>
>>60807602
Some of the warnings require information that only optimisations will reveal.
>>
>>60807545
>being this triggered
kek
>>
>>60807606
fug that's better than mine tbqh
>>
File: 1470882916016.jpg (44KB, 703x692px) Image search: [Google]
1470882916016.jpg
44KB, 703x692px
Thinking of making a graphical front-end to xrandr. Should I use D or Rust?
>>
>>60804534
Am I crippling myself going the Scheme SICP route instead of UC Berkeley Python SICP route?
>>
>>60807606
void pointers can't be deferenced
>>
>>60807741
I'd see D being more productive, especially if the GC isn't a concern
>>
>>60807755
Do you feel crippled? If not, proceed. Else, stop.
>>
>>60807760

It isn't being dereferenced, you're just being misled by retarded declarator syntax
>>
>>60807773
I don't quite mind the GC, and the program doesn't really need that much of a performance in this case.
>>
>>60807779
>It isn't being dereferenced
i know but >>60807355
>write a code segment to make and _print_ a cyclical list
>>
>>60807607
Here's a fairly inefficient solution in Haskell:

numCorrect :: Eq a => [a] -> [a] -> Int
numCorrect xs = length . filter (uncurry (==)) . zip xs

combos :: [a] -> [[a]]
combos states = flip (:) <$> ([]:combos states) <*> states

lengthedCombos :: Int -> [a] -> [[a]]
lengthedCombos n = takeWhile (\x -> length x == n) .
dropWhile (\x -> length x /= n) . combos

solution :: Eq a => Int -> [a] -> [a] -> [[a]]
solution n correct = filter (\x -> numCorrect correct x == n) .
lengthedCombos (length correct)
>>
>>60807778
Not really, but why would they phase out Scheme in favor of Python if it was not better?
>>
>>60807760
int main()
{
void *ptr = &ptr;
void *val = *********(void **********)ptr;
}
>>
>>60807850
I think that was temporary.
http://web.mit.edu/alexmv/6.037/
Looks like Scheme to me.
>>
>>60807355
#include <stdio.h>
typedef struct list_t list_t;

struct list_t
{
int val;
list_t *next;
};

int main(int argc, char **argv)
{
list_t h = {9, &h};
list_t *cur = &h;
do {printf("%d\n", cur->val); cur = cur->next;} while (cur != &h);
return 0;
}
>>
>>60807355
import Data.Function

main :: IO ()
main = print $ fix error
>>
>>60807898
>http://web.mit.edu/alexmv/6.037/
Oh, wow! Thanks for the great link, anon! Never seen an up-to-date MIT SICP course site. Only 10+ years old ones.
>>
>>60807355
l=0:l
main=print l
>>
>>60807934
Well, it looks like they did some restructuring over the years. It was 6.001, and that went end-of-life around 2008. The Python course is 6.0001, and is required for the EECS major now. That isn't a Structure and Interpretation of Computer Programs course, but it did take over its function as an intro course.
>>
>>60807898
Good link my dude, thanks
>>
>>60808035
Yes, I know that MIT 6.0001 is no SICP now. But Berkley has SICP based https://cs61a.org/ now. With Python, and some Scheme+SQL. Not sure whether to move on to that or stick to classic SICP
>>
Where can I read about image morphing? I want a book
>>
>>60808080
I see. Well, Python will get you employed, not so much Scheme. If you care about that anyway. Lisp in general is pretty interesting though,
>>
>>60808088
not a book. but here https://inst.eecs.berkeley.edu/~cs194-26/fa14/
Read Gilbert Strang's linear algebra text.
>>
>>60808143
danke schoen!
>>
>>60808171
bitte
>>
>>60804625
In my experience, yes.
>>
>>60805371
I guess it makes some sense in that it maps well to the familiar C loop
for(int i=first; i<last; i++)
>>
>>60804547
we really need a "practical programming" thread for languages that are actually used and produce useful and interesting programs and a "theoretical programming discussion" thread where NEETs and armchair computer scientists can jerk each other off
>>
>>60808302
you mean we need a "imperative safe space" thread
>>
File: 1496061516822.jpg (113KB, 573x892px) Image search: [Google]
1496061516822.jpg
113KB, 573x892px
>>60808240
Exactly, like a whole bunch of things in snek. However, snek isn't C so there's no point in 0 based indexing bullshit. Fortunately, Lua-tan got it right. Say something nice about her, /dpt/.
>>
What's a good starting point if I want to get into firmware development? I am competent at C and might get a job in that area soon.
>>
>>60808111
I know some python but lack of solid background and confidence forced me to turn to SICP as it promised to open mind in a way. I guess I'll stick with Scheme for now, Python examples won't be too hard to pick up by then, I hope.
>>
>>60805497
>>60805539
this can be very useful in certain cases

languages such as java and C allow bit manipulation.

storing a bool as a bit and storing 8 bools in a byte is extremely memory efficient (compare to python where bools are 22 bytes)

this is extremely useful for prime number generation using sieves, which require a bool array equal to the highest prime number you want to generate.
>>
>>60808353
c, asm should do well for you
>>
>>60808396

>compare to python where bools are 22 bytes
wtf
>>
File: 1494530334316.png (58KB, 680x810px) Image search: [Google]
1494530334316.png
58KB, 680x810px
>>60804534
Is there a program for ubuntu/linux that launches 9 terminals in one window? If not, how would I go about making it in python?
>>
>>60808413
Do you know of any particularities in firmware development that make it differ from writing "normal" userland programs in C?
I know brainfuck, that should translate into ASM fairly well right?
>>
>>60808417

you mean screen and tmux?
>>
>>60808417
What do you mean? I think you might want to look at tmux.
>>
I have set up a bat file to lock a folder, but how do I make it so the password can't be read by opening the bat file itself?
>>
>>60808414
sorry, im mistaken, i just checked python refrence. an int is 24 bytes, i got it mixed up

a bool is 8 bytes in python. still 64 times bigger than it needs to be.
>>
>>60808427
i always though brainfuck was a meme language with no practical applications, but what do i know

anyways, if you want to do firmware prog C and asm should be all you need. I knew someone who worked for HP doing firmware and they said about 75% of it was all C
>>
>>60808439
dont put the password in the bat file.

have the bat file read from a key stored either locally on the computer or on a usb drive
>>
>>60808431
>>60808434
i found terminator. is it similar to tmux
>>
>>60808417
It's called Tilix
>>
>>60808302
Make it
>>
>>60808302
I would like to get jerked off as well anon, please post links to thread once created
>>
File: lockedFold.png (30KB, 781x618px) Image search: [Google]
lockedFold.png
30KB, 781x618px
>>60808473
Let me explain it all.
I have on my PC a thing that lets me see the password only during certain times, not because I have to hide it from people but I have to hide it from myself.
So I had this little bat file and I would open this password I could not possibly memorize.
But now unfortunately I found out that I could just open the bat file with a notepad and read it.
>>
>>60808458
Brainfuck _is_ a meme language with no practical application but I think it teaches you to think about memory management and how to break down complex tasks into manageable ones. It's pretty much ASM with a very reduced instruction set.
>>
>>60808569
$ base64 <<< test
dGVzdAo=
$ echo '#!/bin/bash
echo "Your password is $(base64 -d <<< dGVzdAo=)"' >> gibpasswd
$ chmod u+x gibpasswd
$ sudo mv gibpasswd /usr/local/bin/
$ gibpasswd
test
>>
>>60808663
>sudo
But I am using Windows.
>>
>>60808569
so you just want to keep yourself from reading this password?

change permissions on the file. or use a different file for password with different permissions.

idk what else to tell you. obfuscate the password? store it as hex and have the bat file decode the hex? maybe hash the password and store it in blocks in different files?

why do you want to hid the password from yourself? if your an administrator this is tough to do unless if you just want it hidden on the surface... i mean, if your able to hide the password, your probably able to unhide it whenever you want as well
>>
>>60808679
>But I am using Windows.
well, theres your problem right there anon.
>>
>>60808663
$ base64 <<< test
dGVzdAo=
$ echo '#!/bin/bash
echo "Your password is $(base64 -d <<< dGVzdAo=)"' > gibpasswd
$ cat gibpasswd
#!/bin/bash
echo "Your password is $(base64 -d <<< dGVzdAo=)"
$ chmod u+x gibpasswd
$ sudo mv gibpasswd /usr/local/bin/
$ gibpasswd
Your password is test

Fixed
>>
File: noreallystop.png (733KB, 666x523px) Image search: [Google]
noreallystop.png
733KB, 666x523px
>>60808679
sudo stop using windows
>>
>>60808683
>store it as hex and have the bat file decode the hex
That might be it.
>why do you want to hid the password from yourself?
I have a problem, I fap, a lot, too much, I have an exam in 2 weeks about a fuckload of subjects plus an essay to finish so I can't be doing it 24/7, it used to be that my dick would hurt and I would be forced to stop but now it does not happen anymore, I could go on for weeks, 5 or more times each day, I have to fight myself, I managed to contain it using Leechblock and blocking stuff in a folder, but now that I know, I could exploit at any time.
>>
>>60808143
Linear algebra seems to have a huge number of applications in all kinds of fields, definitely worthwhile to learn.
>>
>>60807355
I guess I'm late to the party, but:
#include <cstddef>
#include <type_traits>
#include <iostream>


template <typename Object, bool is_class = std::is_class<Object>::value>
struct is_list
{
template <typename T, T Object::*>
struct helper;

template <typename T>
static std::false_type has_next(...);

template <typename T>
static std::false_type has_value(...);

template <typename T>
static std::true_type has_next(helper<T*, &T::next> *);

template <typename T>
static std::true_type has_value(helper<decltype(T::value), &T::value> *);

typedef decltype(has_next<Object>(nullptr)) next_tester;
typedef decltype(has_value<Object>(nullptr)) value_tester;

static const bool value = next_tester::value && value_tester::value;
};

template <typename Object>
struct is_list<Object, false> : std::false_type {};


template <typename List>
typename std::enable_if<is_list<List>::value, size_t>::type print_list(const List& list)
{
size_t n = 0;

auto* ptr = &list;
while (ptr != nullptr)
{
std::cout << ptr->value << std::endl;
++n;
ptr = ptr->next;
}

return n;
}


template <typename Type>
struct List
{
Type value;
List* next;
};


int main()
{
List<int> head = { .value = 1, .next = nullptr };
head.next = &head;

print_list(head);

return 0;
}
>>
>>60808777
Sepples truly is the best language.
>>
>>60808777
>>60808786
I fixed it

#include <cstddef>
#include <type_traits>
#include <iostream>


template <typename Object, bool is_class = std::is_class<Object>::value>
struct is_list
{
template <typename T, T Object::*>
struct helper;

template <typename T>
static std::false_type has_next(...);

template <typename T>
static std::false_type has_value(...);

template <typename T>
static std::true_type has_next(helper<T*, &T::next> *);

template <typename T>
static std::true_type has_value(helper<decltype(T::value), &T::value> *);

typedef decltype(has_next<Object>(nullptr)) next_tester;
typedef decltype(has_value<Object>(nullptr)) value_tester;

static const bool value = next_tester::value && value_tester::value;
};

template <typename Object>
struct is_list<Object, false> : std::false_type {};


size_t print_list(...)
{
std::cout << "No elements" << std::endl;
return 0;
}


template <typename List>
typename std::enable_if<is_list<List>::value, size_t>::type print_list(const List& list)
{
size_t n = 0;

auto* ptr = &list;
while (ptr != nullptr)
{
std::cout << ptr->value << std::endl;
++n;
ptr = ptr->next;
}

return n;
}


template <typename Type>
struct List
{
Type value;
List* next;
};


struct NotList
{
int value;
List<int>* next;
};


int main()
{
NotList nhead = { .value = 1, .next = nullptr };
print_list(nhead);

List<int> head = { .value = 1, .next = nullptr };
print_list(head);

return 0;
}
>>
new thread, though
>>60808860
>>
>>60805497
what shit processor do you use mine can address an arbitrary fraction of a byte
>>
>>60808999
FUCK I MEANT AN ARBITRARY FRACTION OF A BIT
NOW THE BAIT ISN'T FUNNY ANYMORE
GOD DAMMIT
>>
>>60808709
Even better (replace MYPASSWORD):

echo '#!/bin/bash' > make-password-shower
echo 'echo '"'"'#!/bin/bash'"'"' > show-password' >> make-password-shower
echo 'echo "echo \"Your password is \$(base64 -d <<< $(base64 <<< $1))\"" >> show-password' >> make-password-shower
echo 'chmod u+x show-password' >> make-password-shower
chmod u+x make-password-shower
./make-password-shower MYPASSWORD
rm make-password-shower


You now have a script called show-password that shows you the cleartext password if executed, which only contains the base64 encoded password, and you don't even have to copy and paste it manually.
>>
>>60808753
How about you just delete your porn and block all porn sites.
Or better yet, grow a fucking spine and overcome the temptation on your own.
>>
>>60809192
If it was so easy then there would be no addictions would it? Alcohol, Drugs, Cigarettes,food and so on.
Thread posts: 323
Thread images: 19


[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.