[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 (Anime Edition)

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: 322
Thread images: 31

File: dptaocp.jpg (98KB, 934x1000px) Image search: [Google]
dptaocp.jpg
98KB, 934x1000px
What are you working on, /g/?

Old thread: >>62235587
>>
Working on my first Ruby project!
>>
File: 1499158142957.png (572KB, 563x706px) Image search: [Google]
1499158142957.png
572KB, 563x706px
Are you a little Anime girl?
http://www.strawpoll.me/13845606
>>
>>62245640
Update for the programming intelligence chart.
>>
>>62245640
I JUST DON'T WANT TO USE CMAKEAUTISTLISTS.TXT ANYMORE
>>
File: 1504518120345.jpg (115KB, 484x510px) Image search: [Google]
1504518120345.jpg
115KB, 484x510px
> tfw even someone's mom is doing data analysis now
>>
>>62245783
#notmymom
>>
>>62245762
Me neither. That's why I use Boost.build instead, it's fucking great.
But the docs are piece of shit however so it is kinda difficult to learn.
>>
>>62245653
Good luck! Ruby is lots of fun.
>>
>>62245762
>>62245810
Should I learn cmake? For now the projects I've been working on were so tiny that POSIX make was enough to build them (not to install them), but now I'm working on a much bigger one would like a full-fledged build-system that could also install it.

GLFW, which I'm using, uses cmake.
libsoundio, which I'm using, uses cmake too.
>>
Why haven't you learned Prolog?
>>
>>62245850
IDK, I just let eclipse handle the makefile autism for me
>>
File: 1503619237990.png (848KB, 676x955px) Image search: [Google]
1503619237990.png
848KB, 676x955px
>>62245698
Why would you ever want to program in Assembly?
>>
>>62245873
greek cred
>>
>>62245873
Internet street cred
>>
>>62245873
I don't know. Knowing how to read covers virtually all practical applications. The rest is covered by intrinsics or can just be learned when needed.
>>
>>62245897
>or can just be learned when needed.
I feel like this is 80% of language-specific shit.
>>
>>62245873
if you want to make a native implementation of a programming language. or if you want to write a virtual machine/emulator. or if you want to debug at the lowest level of abstraction. or if you want to reverse engineering.
>>
>>62245698
binary lambda calculus?
>>
>>62245850
You should definitely move on to advanced build systems which handle header dependencies. CMake is one of them which does the job moderately well but whose scripting language on the other hand is utterly atrocious.
>>
Isnt cmake a standard nowadays?
>>
>>62245698
>no haskell
>>
>>62246035
>yes haskell
>>
File: 1491022720198.gif (1MB, 266x268px) Image search: [Google]
1491022720198.gif
1MB, 266x268px
>>62246041
>>
>>62246021
Certainly not.
>>
>>62246242
What is then?
>>
>>62246259
There is no standard.
>>
>>62246261
cmake is still the industry standard. It's the third generation builder. 4th generation builders like premake are still immature.
>>
>>62246346
>4th generation builders
what the fuck does it do? cmake is already trying to do everything for you
>>
C DOESN'T HAVE SUPERCLASSES? DRRRRUUUUUUMMMMMMPPPPPFFFFF
>>
>>62246346
Nah, meson is the new hotness now.

>>62246390
Go home, poofag.
>>
>>62246399
>Nah, meson is the new hotness now.
I should clarify my meme post.
It's the new "up and coming" hotness, not the "industry standard" hotness.
>>
>>62246390
c doesn't even have a string type. kek.
>>
Working on my first Rust project!
>>
>>62246446
muh char*
>>
File: 1502357646102.jpg (177KB, 709x821px) Image search: [Google]
1502357646102.jpg
177KB, 709x821px
>>62246463
Good work Billy!
>>
>>62246446
>>62246468
https://www.joelonsoftware.com/2001/12/11/back-to-basics/
>>
>>62246510
more like back to the sixties.
>>
>>62246523
You have to know the sixties to work today.
>>
>>62246510
"These are all things that require you to think about bytes, and they affect the big top-level decisions we make in all kinds of architecture and strategy. This is why my view of teaching is that first year CS students need to start at the basics, using C and building their way up from the CPU."

that guy has completely missed the point of programming and computer science.
>>
>>62246510
null-terminated strings are shit
>>
>>62246588
They are. You have to know how they work anyway.

>>62246553
Enlighten me.
>>
>>62246598
Only because of C's ubiquity.
>>
C++ should be the default uni language.
>>
>>62246615
That would literally be one of the worst choices.
>>
>>62246611
For better or worse.
>>
>>62246615
No.

Thanks.
>>
>>62246553
>First year CS students need to start at the basics, using C and building their way up from the CPU.
First semester CS should teach, in parallel:
1) Digital circuits. Every CS student should be able to build a simple adding circuit.
2) Assembly
3) LISP

2nd semester
1) C
2) Haskell or Prolog
3) OOP

That's what my publicly funded European uni did.
>>
>>62246615
C++ is too large to teach effectively in a college course. C is perfect because it is a small, complete language. Same for Java to a lesser extent.
>>
>>62246626
If you learn c++, you will be able to easily learn anything.
>>
>>62246510
>Using strcat like that
Why are people so stupid? Do they not realise that C has far better functions to handle that sort of shit?
int len = snprintf(NULL, 0, "%s%s%s%s", "John,", "Paul,", "George,", "Joel,") + 1;
char str[len]; // We don't even need to use the heap
sprintf(str, "%s%s%s%s", "John,", "Paul,", "George,", "Joel,");
>>
>>62246700
C++ ruins programmers. C is a far better language is basically every regard.
>>
>>62246716
Whats wrong with c++?
>>
>>62246745
Literally everything.
>>
>>62246702
>char str[len]
The article was written in 2001. The VLAs made it into standard in 1999. It probably took a few more years for them to be actually incorporated into compilers. MSVC still doesn't have them AFAIK.
>>
File: c-baby.jpg (248KB, 808x805px) Image search: [Google]
c-baby.jpg
248KB, 808x805px
>>62246716
>>
>>62246775
Le go home, mr sad reddit man.
>>
>>62246761
MSVC only supports C89, it's a C++ compiler
>>
>>62245873
> Why would you ever want to program in Assembly?
Cannot be written in another language
Cannot be written as efficiently in another language
Non-functional requirements (timing, security, robustness) which cannot be met using another language.
Programming a CPU for which C is inefficient (e.g. PIC10/12/16).

There are far more situations where you need to read asm than to write it.
>>
>>62246745
It's not D.
>>
>>62246615
you realize that nobody knows C++ until they're like 40?

it's an insane language
>>
File: 149516498697.png (114KB, 500x464px) Image search: [Google]
149516498697.png
114KB, 500x464px
#include <stdio.h>

#define MAXLINE 1000
/*replace all tabs in input with 4 spaces*/

char wrd_lst[MAXLINE];
int i, c, d;

int main(int argc, char const *argv[]) {

for (i = 0; i < MAXLINE - 1 && (c = getchar()) != EOF; ++i) {
if (c = '\t') {
d = i + 4;
for (i = i; i <= d; ++i) {
wrd_lst[i] = ' ';
}
}
else {
wrd_lst[i] = c;
}
}
printf("%s\n", wrd_lst);
return 0;
}

It runs without errors but wont return anything when it's supposed to return the sentence I put in. Help.
>>
old /g/: Learn the basics of programming well so you can learn other languages quickly just by picking up syntax

nu-/g/: im 16 years old and my programming language is fucking superior
>>
>>62246825
>if (c = '\t') {
12th line
>>
>>62246825
Compile your program with -Wall and maybe -Wextra.
It'll pick up easy mistakes like >>62246835
>>
>>62246845
you forgot -Wpedantic and -Weverything for clang
>>
>>62246811
How are you going to code something which should be fast?
>>
>>62246745
The main "problem" with C++ is that it's too hard for amateur (or just noob) programmers. So they need to invent "objective" criticisms against the language.

Professional programmers just accept that the language's complexity is the price you have to pay for the features (efficiency, portability, compatibility between versions).
>>
>>62246864
No. That takes it too far.
Also, Weverything picks up things which straight-up aren't errors.
>>
>>62246879
>Defending unnecessary complexity
C++ programmers really are the biggest retards.
>>
>>62246879
C++ is more complex than it needs to be for how powerful it is.

If it were its own language rather than just hacking around C until they have to break something, it would be much clearer. I can definitely see a cleaner and equally expressive language buried under all the crap.
>>
>>62246932
Java?
>>
>>62246943
No. It looks more like D, although that's still not exactly right.
>>
>>62246811
> you realize that nobody knows C++ until they're like 40?
If you're not an idiot, you can become competent with C++ (including templates, multiple/virtual inheritance, etc) within a year or two of full-time use.

The real problem is that too many people think that they're entitled to become an expert from reading "Learn C++ in 24 hours" and two weeks of practice.
>>
Learning C++ :-)
>>
>>62246932
Create it then you sly fox
>>
>>62246957
That's true, but there will still be odd corner cases that will trip you up.

Look at initialization for example. It's a fucking mess.
>>
>look up all c++ youtube tutorials
>all of them have a shit ton of views, and way more than any other programming language
>check the comments, they're all gamurs who want to get into game dev
>>
>>62246896
>>62246932
You could get one of the three listed features with far less complexity. The complexity comes from the interactions. For professional use, they're all important. But the people who rail against C++'s complexity aren't professional developers (or they're webdev-tier professionals), so they don't understand this.

People who've only ever programmed for Windows on x86 don't understand why portability matters. People who've never had to maintain code which has been around longer than the interval between language revisions don't understand why version compatibility matters.

The authors of the C++ specs understand why these matter. This is why C++ is complex, and also why it's been around far longer than the various flavor-of-the-month languages, and will still be around when those languages are dead.
>>
>>62247062
There is absolutely no substance to your braindead argument. You have not provided any justification for ANYTHING, and just go on about how you think you're better than everyone else, when in reality, they're all looking down on you.
>>
>>62246835
>>62246845
Thanks. It's an exercises in K&R and that just tells me to use cc in the terminal
>>
Who the fuck has 8 (EIGHT) mouse buttons?

http://www.glfw.org/docs/latest/group__buttons.html
>>
software engineer or embedded electronics?
>>
>>62247145
Save yourself. Embedded electronics.
>>
>>62247108
There are currently 46 mouses for sale
with 12 or more buttons.
>>
>>62246021
I use qmake
>>
File: 1499797154117.jpg (17KB, 320x320px) Image search: [Google]
1499797154117.jpg
17KB, 320x320px
>>62246957
>you can become competent with C++ (including templates, multiple/virtual inheritance, etc) within a year or two of full-time use.
that's bullshit, you just don't know yet how basic your knowledge is
>>
>>62247247
This. I've given up on learning C11 100%. I think in order to do that one would need to write a compiler for it from scratch.
>>
>>62247010
You'd have a chance to learn that shit if it was compactly laid out in one chapter. But nobody knows C++ so they can't explain it like that either. Every book is some retard struggling to learn it himself.
>>
>>62247282
>C11
Didn't add that much and C was simple language already.
>>
>>62247320
You'd be surprised.
>>
File: 1480482012701.png (722KB, 800x1200px) Image search: [Google]
1480482012701.png
722KB, 800x1200px
>>62245640
How to get into type theory, dependent typing, and logic? I am making a programming language of my own and want to make a good typesystem for it.
>>
>>62247337
>_Generic
>anonymous struct/union
>alignment stuff, not sure if you should still just use POSIX
>threads, still using just POSIX
Did I miss something?
>>
File: 1408895307638.jpg (208KB, 945x823px) Image search: [Google]
1408895307638.jpg
208KB, 945x823px
what do you guys put in your technical skills section for sysadmin and techie type jobs? im trying to figure out how to best sell myself for such jobs with what ive acquired over the course of my CS degree and what ive learned on my own, but i dont want to put in basic bitch shit that only detracts from the CV.
>>
>>62245640
class Object{
~Object(){
delete this;
}
}
>>
>>62246761
Just use malloc then.
>>
>>62247396
>double freeing
>>
>>62247398
>dude just use malloc and free bro, like fuck performance nobody cares if you do a system call
dumb microcuck poster
>>
>>62247320
Yeah, I probably just should have written C.
Anyway, C11 did add:
>threads
>atomics
>alignment
>generics
But even when restricted to C89, you find stuff like:
>implementation-defined constant char literals ('hello')
>static in function prototype body (int foo(int array[static 1]))
>undefined behaviour (annex J)
>>stuff like casting into different pointer type other than self or char* is technically undefined because pointers may have different alignment-padding behaviour
>>stuff like subtracting pointers not of the same array (C doesn't assume linear memory)
>>other shit I've probably no idea of
>>62247364
atomics, but that's probably in your POSIX thread clause
also at_exit, at_quick_exit or something
tgmath

>>62247396
Don't know anything about C++, but shouldn't delete this invoke Objects destructor which invokes delete this which enters infinite loop?
>>
>>62247396
class Object{
public:
~Object(){
delete this;
}
};

int main(){
{
Object test;
}
}

Actual "working" code. Causes a "Segmentation fault (core dumped)"
>>
>>62246876
Rust.
>>
>>62247414
>if you do a system call
Most malloc implementations only do a system call if they really need to. (if not enough space has been internally allocated).
Also, the standard says nothing about syscalls on the malloc section. Moreover the compiler is free to replace the call to malloc with x[len].

>microcuck
??
>>
>>62246932
>I can definitely see a cleaner and equally expressive language buried under all the crap.
This is exactly what Rust sets out to achieve.
>>
>>62247433
Object *test = new Object;
>>
>>62247445
He probably meant you should use a single malloc call to do a memory arena (huge memory slot) and implement your own, smarter, not-that generic, faster malloc, operating in that arena.
>>
>>62247458
Rust is a different language with different design goals. C++ was born out of "OOP", Rust doesn't have it at all.

Rust is neat though. I like Rust for the most part.
>>
>>62247463
Why does the first example fail?
>>
>>62247466
This is retarded. Let's put a useless abstraction on top of another abstraction.

The sane thing to do would be to select a different malloc implementation at compile time.
>>
>>62247463
Like that's going to matter
>>
>>62247475
You're not supposed to delete this in the destructor.
>>
>>62247479
>having allocator on top of malloc is useless
Most bigger C and even C++ projects do that. Having allocator for one task and just freeing the allocator after task is done is common pattern.
>>
>>62247479
No, this is what is done in many game engines to squeeze out all possible performance.

When malloc fails to find a free memory block, it does heavy processing of merging remaining free memory blocks into bigger ones, uniting the fragmented memory. This is expensive.

By using different mallocs for different allocations, *knowing how the memory will behave*, like using a different malloc for stacks, vectors, linked lists and such, you can improve performance.

Never matters in 99% of cases, that's why we use Python
>>
>>62247475
You're basically deleting the pointer to the object when the object goes out of scope. After the destructor runs it tries to delete it again but it's not longer there in a sense.

I might be wrong though.
>>
So... Am I retarded for starting with C++? In three years when I check out something else like Python will it seem really easy? Or am I just fucking my brain up?
>>
>>62247516
A retarded pattern.

>>62247518
>markdown formatting
Kys

>game engines
Kys x2

>that's why we use Python
Kys x3
>>
>>62247538
I started with C++. I never learned it. Switched to Python, then to C.
>>
>>62247538
Starting with C++ is a bad idea, there's just too much shit.

Why do you want to learn a programming language?
>>
>>62247538
Just start with something. C++, Java, Python or C are all good. Don't listen to /g/ memes. Just pick something and stick with it for learning. You can always learn more later.
>>
1) Have global structure
2) At start create the structure and store pointer to in every other object that needs it
3) don't store pointer to it and pass it around in function paramter
which one?
>>
>>62247538
Start with Scheme. C++ will teach you nothing about CS.
>>
>>62247518
>it does heavy processing of merging remaining free memory blocks into bigger ones, uniting the fragmented memory.
Not the guy you're responding to, but what the actual fuck are you talking about? That's not how malloc works at all, malloc will use a combination of brk and mmap to allocate pages. Location of physical pages is irrelevant, as it will be handled by the page fault handler.

>>62247518
>>62247516
It's true that bigger projects will make their own linked list and vector allocator abstractions.
>>
>>62247526
>You're basically deleting the pointer to the object when the object goes out of scope. After the destructor runs it tries to delete it again but it's not longer there in a sense.

No, you're right.

You're essentially doing the same thing as this:

struct Object
{
int member;
};

int main()
{
struct Object object;
free(&object); // breaks because object is allocated on the stack
}
>>
>>62247558
>which one?
3) is the only thread-safe one
>>
>>62245659
Yes.
Uguu~

>>62245698
I disagree with this, but I still kek'd

>>62246615
I learned C++ in College, not C.
We should have learned C first...
Glad I picked it up afterwards.


For anyone interested in a more immediate way to talk, we have a unified /g/ Discord Server here:
https://discord.gg/wXGrJ7q
Whether you want to discuss programs, hardware, distros, or even other STEM fields, we got channels for all that.
>>
>>62246825
Please use meaningful variable names.
>>
>>62247644
b-but then it would actually be readable...
>>
File: 669u.png (26KB, 329x275px) Image search: [Google]
669u.png
26KB, 329x275px
>>62247639
>https://discord.gg/wXGrJ7q
Fuck off you cancerous idiot.
>>
>>62245698
Where the fuck is malboge?
>>
>>62247721
>he doesn't know
>>
>>62247721
It's an esoteric language designed to be as hard to write in as possible. Just stick to brainfuck.
>>
>>62247742
That's literally the point, so shouldn't it be at the very bottom then?
>>
>>62245698
>no prolog
>>
>>62247797
because the list only has programming languages
>>
>>62247778
oh ur about that chart
dunno haven't bothered to look at it
>>
>>62247806
and prolog isnt a programming language?
>>
>>62247817
you came to that conclusion, not me so it must be true, prolog is not programming language.
>>
>>62245698
So is this implying that javascript isn't garbage?

Take a guess at what this evaluates to in javascript: [[][[]]+[]][+[]][++[+[]][+[]]]
If you guessed "n", you're correct
>>
>>62247742
>>62247778
The chart has standards of practicality. Even brainfuck has a logical purpose, as opposed to meme languages designed for the purpose of being hard.
>>
>>62247826
>Programmation en Logique
>Paradigm: Logic programming
imperative and functional languages have their place, but theyre not the only kinds of languages my dude
>>
>>62247858
Practicality for what? Embedded systems? Webdev? GUIs? Aerospace?

It's retarded.
>>
>>62247868
>Müller designed Brainfuck with the goal of implementing it with the smallest possible compiler, inspired by the 1024-byte compiler for the FALSE programming language. Müller's original compiler was implemented in machine language and compiled to a binary with a size of 296 bytes.

>As Aminet grew, the compiler became popular among the Amiga community, and in time it was implemented for other platforms. Several brainfuck compilers have been made smaller than 200 bytes, and one is only 100 bytes.
>>
>>62247848
>implying you can't do even more retarded shit in any language
>>
>>62247362
Read type theory books; start with TAPL and go from there
>>
There are some languages that are simply better suited for video games, whether by giving you better tools, allowing you to optimize performance better, etc. You can make games in HTML5 but I wouldn't even try to use it for anything beyond simple casual games.

But even "suboptimal" languages can be used to great effect. For example, Java is often seen as inefficient for video games, and yet one of the most popular games of all time (Minecraft) was done in Java. Would it have been better if it was done in C++? Sure, that's definitely possible. But it works well enough, so the player doesn't care (or even know, in most cases). In the end the thing that matters most is what you feel most comfortable working with. If you're a great Java programmer but you have very little C++ experience, there's literally nothing wrong with just sticking with Java.

Just because a language is more powerful/more efficient/more popular doesn't mean it's also strictly better. There's always your own level of skill to consider and how much time you can put into development. If your game would be easy to make in something simple and user-friendly like Game Maker, there's no point in learning C++ just because it's a "better" language overall.

Unless of course you enjoy learning new languages and you use game development as a fun way to get more familiar with them, in which case go wild.
>>
>>62248298
People didnt love Runescape or MC because it was written in java m8.
seems like pasta but google returns nothing.
>>
>>62246825
>
#define MAXLINE 1000

Why do C tards like to do that?
>>
>>62247864
>prolog is future, it'll decide tasks instead of us just by giving it constraints!
>awww fuck it, it's faster to develop in C
Or how I programmed Sea Battle bot, the post
>>
>>62248327
Because C doesn't have true constants.
static const
doesn't technically name a compiletime constant and
enum
 only works for integers.
>>
>>62248327
You clearly don't need MAXLINE more than 1000.
>>
>>62248327
because they like to turn a constant space streaming program into a retarded inefficient abomination with artificial limits because anything else in C is a fucking chore so you have to stick to hello world-tier shit

(I know it's not what you're asking about)
>>
>>62248327
Only way to ensure immutability.
>>
File: reply.jpg (270KB, 924x564px) Image search: [Google]
reply.jpg
270KB, 924x564px
How does this make you feel?
>>
File: ag.png (28KB, 965x433px) Image search: [Google]
ag.png
28KB, 965x433px
>>62245659
/g/ best board
>>
>>62246825
Why did you choose to write it like that?
#include <iostream>
using namespace std;

int main() {
string line;
while (getline(cin, line)) {
for (char c : line) {
if (c == '\t') {
cout << " ";
} else {
cout << c;
}
}
}
}
>>
>>62248385
I started to program with BASIC, in school I was taught Pascal.
Of course I feel great for him.
>>
>>62248469
REEEEEE SEPPLES BAD
>>
>>62248385
Why is it a bad thing to start with C# or Java? I'm still a programming brainlet, so I have no clue desu
>>
>>62248361
?
>>
>>62248520
It's not.
>>
File: 1503929824169.jpg (27KB, 510x498px) Image search: [Google]
1503929824169.jpg
27KB, 510x498px
How fast is Golang in comparison to C? It seems to be a nice language.
>>
>>62248526
C has no sense of safety.
If you want absolute assurance MAXVALUE will always be 1000, you use defines.
>>
Is this true, /dpt/?

>>>/v/389248869
>>
>>62248550
Go is shit, maybe widen your scope to find out what a nice language could actually be.
>>
>>62248608
Tell me your nice language.
>>
>>62248604
it is not.
/v/ are the kings of Mt. Stupid
>>
>>62248385
C++ is a great starting place, its simple enough, is very similar to a lot of other languages, cross platform and forces you to learn a little bit about memory management.
>>
>>62248469
That's not really impressive for a language that pretends to be modern
>>
>>62248665
>C++ is a great starting place, its simple enoug
lol
>>
>>62248469
I'm at the end of the first chapter of K&R. I'm using what it's taught me so far to make this.
>>
>>62248687
Besides the #include, what's not modern about it?

>>62248695
That's C++, not C.
>>
>>62248700
>That's C++, not C.
I am now confused by what >>62248469's question was? was he asking why I didn't write it in C++?
>>
>>62248719
Yes. So ignore him.
>>
>>62248719
I'm telling you to use strings
>>
fuck opengl though, not even portable
>>
>>62248739
How so?
>>
File: DINvtwTVoAIe83Y.png:orig.png (1018KB, 800x938px) Image search: [Google]
DINvtwTVoAIe83Y.png:orig.png
1018KB, 800x938px
>>62248660
Haskell is the nicest.
>>
>>62248749
He's a brainlet.
>>
>>62248752
haskell is the incest
>>
Really?

>>>/v/389250095
>>
>>62248770
Why don't you just discuss it there if you care so much?
>>
Is he right?
>>>/v/389250547
>>
>>62248854
No? Rust is catching up.
>>
>people replying to /v/ cancer
>>
>>62248863
Can you do arena allocation in Rust?
>>
>>62248896
Can you mmap memory into packed struct in Rust?
>>
>>62248896
https://doc.rust-lang.org/1.1.0/arena/
>>
>>62248921
https://glium.github.io/glium/mmap/struct.MemoryMap.html
>>
>>62248896
You can do just about anything C can do from or with Rust, anon
>>
>>62248752
Memest, yes.
>>
>>62248969
How about fuck up my segments hard?
>>
>>62248998
I already did fuck up your segment, OP of the /v/
>>
>>62248969
Fuck off SJW.
>>
>>62249006
Nice false flagging
>>
>>62249006
no
>>
>>62248863
Rust is more than catching up. It's behind in the benchmarks game but in real world software it's blowing C++ out of the water when it comes to performance AND development time.
>>
>>62249037
Fuck off no it isn't.
>>
>>62249037
Rust and C++ is both neck to neck both in terms of performance and development time.

To be pedantic, Rust is a bit quicker to develop with and C++ binaries generally a bit more efficient.

Although C++ hasn't had a good competition apart from C since it's birth. However Rust has the potential to surpass C++ one day since it's better designed. C++ has the disadvantage of "shooting first", just like C did.
>>
What does /dpt/ think of thenewboston/Bucky Roberts? Is he /ourguy/?

https://www.youtube.com/channel/UCJbPGzawDH1njbqV-D5HqKw
>>
>>62249118
Rust is literally censoring its syntax because it's being developed by SJWs. It has no hope.
>>
>finally understand haskel
>my ego is in tatters
>pick up something I could not understand before
>it's easy as fuck now
wew, do I have superpowers now?
>>
>>62249120
a) Give HookTube links, not YouTube links.
b) It's not /wdg/, fuck off.
>>
>>62249120
Video tutorials will never give you in-depth knowledge like books do.
>>62249135
How did you think that's a coherent response?
>>
>>62249143
whoktube

no
>>
>>62249120
he's alright for beginner stuff
If there's a louis rossmann attitude but for programming, that'd be /ourguy/. I don't even have a mac
>>
>>62249143
Bucky has comprehensive tutorials in everything though: Java, C, C++, Python, among several others, and even has series on Physics, Chemistry and Biology. He even went into the wild and lived there for 21 days without taking any equipment aside from a vlogging camera.

How can /dpt/ even compete?
>>
>>62249137
What was your path to reaching Haskenlightenment?
>>
>Implement constant propagation
>Half of my test suite is "assert(true)" now
>>
>>62249124
Lol at Torch keeping up with a fucking compiled language. Lua is love, Lua is life. Praise Mike!
>>
How to spot a brainlet skid
>he uses LOOa
>>
so how are you supposed to namespace shit in ruby?
just put everything in a single huge ass file with a module to wrap everything?
>>
>>62249214
Chronologically:
>LYAH (shit tier), didn't complete it
>Programming with haskell by Richard Bird (too complex), didn't complete it
>Gave the fuck up
>tried learning monads once
>gave the fuck up
>Started reading "Thinking Functionally with Haskell" by Richard Bird, stopped reading after two-thirds of the book because it was too complex.
>started reading "Programming in Haskell" by Graham Hutton. Honestly, the best book for beginners.
>Started reading this: https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/
>finished both of these, finished both books by Richard Bird, threw LYAH in the trash.

Protip: The guys talking math during haskell discussions on the internet are way above you, and you don't ned to know all that too build intermediate haskell programs.

I built:
>A GTK3 calculator
>A TON of mathematical examples
>Sudoku, Game of Life, Nim, Tic-Tac-Toe, Go (no AI)
>The cyptopals challenge
>~55/99 haskell problems https://wiki.haskell.org/H-99:_Ninety-Nine_Haskell_Problems
>Brainfuck interpreter
>Static website using Hakyll

Now I'm trying ot build a minimal text editor, and reading Parallel and Concurrent Haskell.

took me a year, but I only tried consistently for a month. Everything i built was done during this month. Was worth it IMO.
>>
How does dpt feel about R?
>>
>>62249223
So your tests don't test anything? Bravo.
>>
>>62249412
just awful; lots of useful libs but language itself is just horrendous
>>
File: out_xrandv2_.png (202KB, 892x720px) Image search: [Google]
out_xrandv2_.png
202KB, 892x720px
I made my own pseudo random number generator. Here's a picture that's been random dithered using my random number function.
>>
>He isn't learning graduate-level mathematics, whether at university or through self-teaching
>He doesn't program in C, Lisp and Haskell
>He hasn't written a compiler or a bootloader
>He doesn't use Emacs... or Vim (Vim is borderline brainlet tier, but it's still miles better than Sublime, Nano, Notepad++, Visual Studio, etc.)
>His everyday computing isn't done on Arch, Gentoo, Slackware, Void or FreeBSD
I can't believe brainlets like this exist. It's kinda gross, honestly.
>>
File: kanako.png (315KB, 430x430px) Image search: [Google]
kanako.png
315KB, 430x430px
Who is the best Touhou, and why is it Kanako?
>>
>>62249715
Where does Lisp fit between C and Haskell?
>>
>>62249405
Are you a NEET?
>>
>>62249799
as featureless as C without any benefits of Haskell
>>
>>62249839
exactly.
>>
File: 1490484251913.jpg (32KB, 358x344px) Image search: [Google]
1490484251913.jpg
32KB, 358x344px
>>62249688
nice
>>
>>62249799
Like C and Haskell, it takes an IQ of 130+ to use. It's also the most powerful programming language, for a multitude of reasons you can easily find by StartPaging.
>>
>>62249405
Thanks for sharing! Good job on going through with it despite setbacks, and good luck with your future learning efforts.

>>62249830
Maybe he finally found time to focus on this stuff during the summer?

>>62249688
Haha, cool. How does it work?

>>62249715
>>62249867
Thanks for your contributions, there weren't enough memes in this thread today :)
>>
>>62249830
no, I just had a ton of free time.

Also I don't sleep a lot.
>>
>>62249715
>he hasn't invented computers

I can't believe actual brainlets think THIS is impressive for dpt street cred.
>>
>>62249950
>Thanks for sharing! Good job on going through with it despite setbacks, and good luck with your future learning efforts.
t-thanks
>>
Is python the easiest thing for a beginner to learn?
>>
>>62250024
yes, you can write shit and it will work
>>
>>62249172
Youtube wrap-up site which doesn't gives (You)s to Google.
>>
>>62250035
it just werksâ„¢
>>
File: 8923415.png (154KB, 400x347px) Image search: [Google]
8923415.png
154KB, 400x347px
>>62249405
>>
File: sad mexican cat.jpg (60KB, 550x412px) Image search: [Google]
sad mexican cat.jpg
60KB, 550x412px
what did i do to deserve async programming
>>
>>62250287
use OOP instead of FP
>>
>>62250306
Who said I was doing FP?
>>
>>62250323
You're not, that's what your problem is. That's what you did to deserve it.
>>
>>62250349
Oh, I get it.

Never done FP, though.

Well, once. It was in college, he was cute. It didn't last, though, so it doesn't count.
>>
g++ -std=c++11 -Wall -Wdeprecated -pedantic "%f" -o "%e"

what does
"%f" -o "%e"
mean?
>>
>>62249950
>Haha, cool. How does it work?
It has two seed variables, and it uses bit shifting, NOT, and XOR to produce the random numbers.
>>
>>62248345
what part of "right tool for the job" dont you understand?
>>
how do I make a lexer?
>>
>>62249118
Rusts syntax makes me puke.
>>
>>62245698
>C is high level assembly
>is at the bottom
wow are you fucking stupid?
>>
>>62250702
make lexer
>>
>>62250765
thanks
>>
>>62250746
That is a troll image you mong.
>>
I've been going through the C second edition and I got to around chapter six before I got tired of all the annoying string management bullshit so I made a bunch of structures.

So far they're dynamically allocating (I still have a bit of writing to do for destroying them cleanly) but I have a string structure (which holds it's index in an array; I might add other things), a structure to hold the strings which has a reference counter (so I can keep track of at least how many things are using it for clean destruction) and a parse structure so I can hold a string structure and some options (and of course a reference counter). The general idea being I can specify how to/how something is sorted, I can dynamically allocate strings of arbitrary length (which will probably be used to store files, assembly, etc later). I got tired of using the basic getch and getchar which is made during the exercises, and will instead have a structure which can handle all of it. I might switch to dmflags for sorting options and just modulo out the sorting options (i.e. folding capitals and lowercase, numeric, etc). I was first realizing how useful it was to just read an input all at once (for parsing chars/tokens/words) and just got tired of having to tweak and deal with both logic and data representation at the same time. I included a name field for the string and parse structures so when I start using them I can name them and print them during debug so I won't just have "error parsing string" but "error parsing string in structure fileholder"

Cleanly destroying was actually something I think I have done, but I wanted to do random de-allocation and inserting. By keeping a value for the count of strings in a structure, all I have to do is move the most recent pointer to the now deallocated string and decrement the string count. I'm considering adding an int to each string, so I can instantly know where the end of the string is/the length without having to check every time.
>>
>>62250702
Usually just matching the next lexeme with a regex is good enough. Something like this:
while string is not empty:
for each lexeme:
if matching string to /^(<lexeme.regex>)(.*)$/ succeeds:
lexemes.push(first match group)
string = second match goup
>>
>>62250835
P.s. Something really nice with the string structure, it uses pointers to the strings. This way if a string is being shared to another task the pointer in the task still points to the string in memory, and knows where the higher-level structure is for proper deallocation. With the index of the lower-string held in the structure,I can cleanly tell the functions which lower string structure to derefence, decrement the reference counter, AND not need to change the pointer in the task. because it's pointing directly to the data and not using the structure for access.

I have separate adding functions too, one for creating and sharing a string (which would need to be deallocated properly for the task and structure), and the other for simply inserting strings (if I'm sorting a block of text I can just insert like 100 strings before passing them on to a sorter/parser, I don't need to keep track of them).
>>
Quick question:
If I want to use for example vector or string in a header file, do I include their respective headers or forward declare the types?
C++ obviously.
>>
I'm generating random numbers with
srand(time(NULL))
seed for rand.
But if I spam print quick enough change in numbers is too predictable. Is there a way to manipulate that seed to have it change faster?
>>
>>62250979
use an actual seed.
>>
>>62250979
>uses time as seed
>wonders why it only changes once per second
hmmm
use a library for actual number generation dummy, they also include proper seed generation
>>
>>62250977
Include the header.
>>
File: why wont this work.png (16KB, 732x438px) Image search: [Google]
why wont this work.png
16KB, 732x438px
why wont this bash work?
>>
>>62251036
In the header file?
>>
>>62250468
that's from a bash statement, isn't it?
>>
>>62251049
Yes.
>>
>>62251042
When you execute the script, it enters a subshell. If you're in a shell, type bash, cd into a directory, then exit, you'll be back where you started. The same happens with the script: bash starts executing it, cd's, then exits.
>>
>>62251067
But then it's included in the cpp file and the header file. Feels really fucking redundant
>>
>>62251076
what do i do then? i also tried export gitdir=~/Documents/Git but it also does not work with a new terminal
>>
>>62251079
The include guard will ensure that it's only truly included once.

Your .cpp is including its .h/.hpp right?
>>
>>62251079
>Feels really fucking redundant
Welcome to C.
You should leave and move on to something with modules.
>>
>>62251098
What exactly do you want to accomplish?
>>
>>62251131
i want to try having shortcuts that i can use from anywhere? currently all my shortcuts are in ~/. directory.
>>
>>62251052
I figured it out since, its from from setting the compiler options in geany, so %f is the sorce files and %e is the name of the project or something
>>
>>62250979
You only need to call seed once nigger.

Also, you should be using a better source of entropy like /dev/urandom on Linux and CryptGenRandom() on Windows.
>>
File: 1502124588379.png (361KB, 804x696px) Image search: [Google]
1502124588379.png
361KB, 804x696px
>go to uni library
>programming section
>JavaScript book is as big as C and C++ books
>>
File: file.png (133KB, 1858x1080px) Image search: [Google]
file.png
133KB, 1858x1080px
>>62251103
Yes.
>>
>>62251196
That's probably because it also teaches you about the bad parts of JavaScript. Read JavaScript: The Good Parts and you'll know everything you need to know. You stupid frogposter.
>>
hey i know this isnt a request thread but id like a single thread that lets me go from a profile like this
https://eu.pug.champ.gg/player/76561198061916408
to this
http://etf2l.org/search/76561198061916408/
with a single click

some kind of link or button, is that possible?
>>
>>62251208
Please stop encouraging header guards in favor of #pragma once
And no, he probably doesnt need to worry about some obscure unsupported compiler from the 90s.
>>
>>62251249
I actually prefer pragma once, but some package in Atom auto-generates header guards if i type "once" so I just stuck with it.
>>
>rust stdlib doesn't even have async/non-blocking io
What are they thinking?

>rust is probably only going to have stackless coroutines
Why would they do this to their language?

>rust still doesn't have real HKTs
>rust still can't guarantee TCO
>>
>>62251215
Why not just use a language that's not 90% bad?
>>
Is anyone here involved in hiring at their jobs? Would you ever hire an autistic sperglord who goes on 4chan?
>>
anybody want to write me a GNU assembly function x86, ATT syntax that takes a number as its argument and prints the number without using any libraries
>>
>>62251276
>>rust still can't guarantee TCO
SAD
>>
>>62251249
There are good reasons why `#pragma once` is not a standard. The same header file can in practice exist in multiple places in the filesystem which makes this kind of thing impossible or ambiguous. Header guards let you define yourself a key which determines the uniqueness of a header file, rather than relying on the filesystem.
>>
File: 1496772534156.jpg (26KB, 433x380px) Image search: [Google]
1496772534156.jpg
26KB, 433x380px
Why should i use iterators again?

using c++
>>
>>62251309
If that's what stands out on your application then no?

Who cares what you do in your spare time, noone should even know; just do your job and don't embarrass the company by proxy
>>
>>62251276
Just install a 3rd party library from github because we dont want a """""bloated""""" STD :^)
>>
The following program compiles but I can't run a.out on a file, it just tells me "Illegal instruction: 4", which under macOS apparently means I'm using instructions my processor doesn't understand.
I can't pinpoint what's wrong though. Could I get some pointers?
#include <stdio.h>
#define LIMIT 25 /* max word length */
#define IN 1
#define OUT 0
int main()
{
int input, i, j, status;
int length[LIMIT];
for (i = 0; i < LIMIT; ++i) length[i] = 0;
status = OUT;
while ((input = getchar()) != EOF) {
if ((input >= 'A' && input <= 'Z') || (input >= 'a' && input <= 'z')) {
status = IN;
++j;
}
else {
status = OUT;
++length[j];
j = 0;
}
}
for (i = 0; i < LIMIT; ++i) {
printf("%d: ", i);
for (j = 0; j < i; ++j) printf("*");
}
}
>>
if you use a slow language you are speeding up climate change, please use C so our children can live
>>
>>62251349
>write some C
>crashes and kills 500 people

h-heh, at least OUR children are alive
>>
>>62250746
It's also considerably slower than Assembly so peanuts like you can adapt.
>>
>>62251346
If there's one thing I've learned from writing and supporting software it's that having third party dependencies is extremely dangerous.
>>
>>62251324
>The same header file can in practice exist in multiple places in the filesystem
doctor it hurts when i do this
>>
>>62251329
p o l y m o r p h i s m
>>
>>62251400
All the better when your language actually encourages it too. :^)
Rust is a joke.
>>
>>62251329

Because range-based for loops.

>>62251276
>>62251312

As the only current backend for Rust is LLVM, and as LLVM can guarantee TCO when told to, this argument isn't quite valid.

>>62251324

Issues I wasn't even aware of. Interesting.
>>
>>62251405
This wouldn't happen just in your own project, but sometimes you might be working with some library or framework with its own include dir which bundles the libfoo header-only library for example and uses it in its headers.
>>
>>62251324
But why won't the compiler to assign an unique hash to every file that has a pragma once?
>>
>>62251329
so you can do map/reduce type stuff it just makes shit look neater
>>
>>62251309
not really
most /dpt/ topics are actually useless in an actual work environment
>>
Having trouble with nested loops in Lisp.

(defun coord-neigh (ary coord)
(loop for x from (- (car coord) 1) to (+ (car coord) 1)
collect (loop for y from (- (cadr coord) 1) to (+ (cadr coord) 1)
collect (aref ary x y)))))

What it returns is '((0 1 0) (1 0 0) (1 1 0)).
What I want it to return is '(0 1 0 1 0 0 1 1 0).
>>
Roses are red
Violets are ... violet
Allahu Akbar
Let's kill the pilot
>>
>>62251347
sounds like a problem with your compiler
>>
>>62251441
>LLVM can guarantee TCO when told to
I can't tell Rust to tell LLVM to guarantee it. That's the problem.
>>
>>62251513
I use clang.
>>
/dpt/ sorry for the obnoxious post, I know that most of you will think that i'm asking about "le hacker xd" but I'm sick of programming useless shit. I want info, I want to program cool projects that I know they will be useful and I will make money out of them whatever the morality behind them.
So my question is, where do I find information about "darker" stuff? If the answer is deep web, give me something specific, all I see there is dude weed lmao. I don't care if I program for the russian mafia, I'm just sick of wasting my time in stupid shit.
>>
>>62251451
That works if the files have the exact same contents and are the same version of the header. (So not libfoo-1.1 in your project and libfoo-1.2 in some header bundled in some other project) And of course there's issues with line endings etc.
>>
>>62251546
See if the Kremlin has any openings and brush up on your cykan
>>
>>62250684
It was a course project.
>>
>>62251528

-C opt-level=2
>>
>>62251634
Not part of the language.

Even Scala has @tailrec.
>>
does learning node.js turns me into an untermensch?
>>
>>62251662

It's a flag for the ONLY COMPILER FOR THE LANGUAGE
>>
>>62251676
So what?
>>
>>62251513
I also checked and I'm not using an outdated version of clang.
I don't understand
>>
New thread:

>>62251727
>>62251727
>>62251727
>>
>>62251680

If there is only one compiler for the language, the language spec can be damned because the compiler spec guarantees what you want.

>>62251673

Learning will never turn you into an intermensch
Using node.js for a serious project, however...
>>
>>62251758
>If there is only one compiler for the language, the language spec can be damned because the compiler spec guarantees what you want.
That leads to madness. Look at Scala.
>>
>>62251347
What CFLAGS are you using? Try -march=x86-64 -mtune=generic

>>62251208
Is there any reason you're using `Teacher *` instead of `Teacher`? If `Teacher` holds some kind of resource, you can instead use `m_teachers.push_back(std::move(teacher))`, changing to `void Department::add(Teacher teacher)`, and calling the `add` function with `std::move` when you call it with an lvalue Teacher, then you just need to make a move constructor which takes a `Teacher &&`.

If `Teacher` doesn't hold a resource (doesn't have a destructor), then none of this is necessary and you can just use `Teacher` instead of `Teacher *` and it will just make copies.
>>
>>62251832
>Try -march=x86-64 -mtune=generic
Still gives me the same error when running the executable. I'm not using any flags otherwise
>>
How do I get started with learning Qt? I don't really know anything about it yet (trying to learn something else other than WPF), but I'm looking online and it seems confusing with all the different versions it has? Like there's Qt Widgets, QML, Qt Quick 1, Qt Quick 2, etc. What's modern/best? How do I get started?
>>
>>62251939
>How do I get started with learning Qt
don't
it's a god damned disaster
windows API is legitimately much simpler
I don't even know how they fucked up that bad
>>
File: how.png (90KB, 658x592px) Image search: [Google]
how.png
90KB, 658x592px
In GLSL, how do I "combine" two colors from different textures in one fragment shader?
Like imagine how in photoshop you have one layer with the color (1,0,0,1) (Red, 100% opacity) and a layer on top of that with the color (0,0,0,0.5) (Black, 50% opacity), the result should then be pic related.
I feel like a retard but I can't figure out how to do it.

// fragment shader
out vec4 fragColor;

void main() {
vec4 colorScreen = texture(textureScreen, gl_FragCoord.xy / resolution.xy);
vec4 colorOverlay = texture(textureOverlay, gl_FragCoord.xy / resolution.xy);
fragColor = colorScreen+colorOverlay; // ?????
}
>>
>>62252094
mix(colorScreen, colorOverlay, colorOverlay.a)
>>
>>62252076
I want to write software that will work on both Windows and Linux though. I'd always heard good things about Qt. What would you suggest instead then?
>>
>>62252425
I don't know, my software is cross platform and the linux version never needs to have a GUI so I don't include one
but there has to be something better than QT
consider using a graphics library like SDL or SFML instead if you don't mind the slightly increased hardware requirements
Thread posts: 322
Thread images: 31


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