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

File: dpt.jpg (32KB, 470x450px) Image search: [Google]
dpt.jpg
32KB, 470x450px
New and improved waifu edition.

What are you working on, /g/?

Old thread: >>61268823
>>
File: 1499328881504.png (846KB, 700x990px) Image search: [Google]
1499328881504.png
846KB, 700x990px
Learning Haskell.
>>
File: 1498370543100.gif (982KB, 320x287px) Image search: [Google]
1498370543100.gif
982KB, 320x287px
>>61273362 #
>>you have to tinker with it for days by editing config files
>he doesn't use ubuntu
>>downloading apps to change confs
>he doesn't use ubuntu
>>downloading packeges, extensions
>he doesn't use a package manager (?!)
>>downloading necessary apps from github and having to MANUALLY COMPILE THEM and it just gives fucking BULLSHIT ERROR MESSAGES why it won't compile
>he... what the fuck are you doing
>>compiling drivers for the 3rd time because you forgot an argument and it just doesn't werk
>compiling drivers
>?!??!??!?!?!?
>he DEFINITELY doesn't use ubuntu
>>making it compatible for microsoft things like getting MS fonts and wine installed
>he uses wine
>>having to make it look like either mac os or something would look like from a bad movie with terminals and text everywhere
>he doesn't use gnome
>>getting rid of screen tearing
>he doesn't use gnome
>>having to read a wiki for a different distro when something doesn't work for your distro and some things are named differently or are in different places
>he doesn't use ubuntu
>he doesn't use a package manager
>>making friends with choppy animations becuase no linux graphical desktop environment can into smooth animations
>he doesn't use gnome

>he doesn't use ubuntu
>he doesn't use gnome
>he complains about how hard linux is as a refutation of the suggestion to use ubuntu gnome
>he logic

Give it up Winshill, Windows may be better than Linux but Ubuntu Gnome is better than Windows
>>
>Haskell
When your fizzbuzz needs to be pure.
>>
>>61273539
What setup?
>>
File: compiler-dmd.png (16KB, 294x294px) Image search: [Google]
compiler-dmd.png
16KB, 294x294px
>>61273495
Is that Winry Rockbell?

Anyways,
Generally, garbage collection is pretty straightforward if you do one or the other of the following:

(1) Have purely sequential code with generational/incremental GC or reference counting (naive or deferred). That is something that's very well understood and generalizable to multiple threads as long as you have thread-local heaps (so that each threads operates sequentially as far as memory management is concerned).

(2) Have concurrent code with a stop-the-world garbage collector. You can these days basically just link the Boehm GC and have a pretty good baseline for that approach. The downside is, of course, that GC pauses for multi-GB heaps can run to several seconds.
>>
File: beutifully_named-File.jpg (616KB, 1257x785px) Image search: [Google]
beutifully_named-File.jpg
616KB, 1257x785px
what is the hot new language. I want to get in early this time
>>
>>61273566
Rust, I suppose. Or try Nim.
>>
File: 1494231935640.jpg (8KB, 225x225px) Image search: [Google]
1494231935640.jpg
8KB, 225x225px
>>61273495
i am a programming noob who has no money but i have an idea for an app. i know some basic stuff like variables and some functions but my app will definitely need some sort of database.

does anyone know of a good online crash-course or guide to start learning this shit?

i dont think i will be making a polished app anytime soon but im hoping can atleast make a crude semi functional concept app to try and get an investor or partner up with people who can make this app happen.
>>
>>61273566
idris
>>
>>61273556
3) do gc at compile time
>>
>>61273605
Use JavaScript to make a web app and a back end.
>>
>>61273566
D
>>
>>61273605
Type "full stack web dev" into your favorite search engine.
>>
find missing numbers in a sequence from 1 to 95000
>>
>>61273730
73
>>
>>61273760
you wot m8
I just want to find the number ID of the students who failed the official examination
>>
>>61273495
>What are you working on
I'M WORKING ON KILL ALL ANIME
KILL KILL KILL KILL KILL
>>
>>61273542
Not at all
>>
Wish I had haskell right now.
How do I interleave a bunch of actions with an action
interleave (print 5) [getLine, newStdGen, readLn]
=> [getLine, print 5, newStdGen, print 5, readLn]
>>
Common Lisp nigga here, if I do
(drakma:http-request link-to-file :want-stream t)

Will it download the entire file and then make it a stream, or will it download as much bytes as we request?
>>
File: 58858989.jpg (67KB, 700x700px) Image search: [Google]
58858989.jpg
67KB, 700x700px
>>61273495
Thank you for doing /dpt/ the right way.
>>
>>61274039
Thank you for not living near me, stupid weeb.
>>
>>61273730
// missing_from_sequence(sequence, len, lowest, highest)
// result is 0-terminated and must be freed by caller
// returns an array only containing 0 if none missing
// sequence must be non-empty
// and in strictly ascending order,
// with first element greater than or equal to "lowest",
// and last element less than or equal to "highest"
// if these assumptions are violated,
// cleans up the return temporary and returns null
// example:
// int sequence[5] = {1, 3, 4, 5, 8};
// int *missing = missing_from_sequence(sequence, 5, 1, 9);
// missing would be {2, 6, 7, 9, 0}
int *missing_from_sequence(int *sequence, int len, int lowest, int highest) {
if (len == 0) return 0;
int *missing;
int mlen = highest - lowest + 1;
missing = malloc(mlen*sizeof(int));
int i = 0;
for (int n = lowest; n < sequence[0]; i++, n++)
missing[i] = n;
for (int j = 0; j < len - 1; j++) {
if (sequence[j] >= sequence[j + 1]
|| sequence[j] < lowest
|| sequence[j] > highest) {
free(missing);
return 0;
}
for (int n = sequence[j] + 1; n < sequence[j + 1]; i++, n++)
missing[i] = n;
}
for (int n = sequence[len - 1] + 1; n <= highest; i++, n++)
missing[i] = n;
missing = realloc(missing, (i + 1)*sizeof(int));
missing[i] = 0;
return missing;
}
>>
>>61273730
[/code]
(loop as i from 1 to 95000
collect i)
[/code]
>>
I made a thing:
flashplay.azurewebsites.net

Seems that Firefox/Chrome won't load up flash files from disk any more, so I made a website that lets you upload files and feeds them back to you with the correct mime type. Nothing gets saved to disk or anything.
>>
>>61274177
I think you've misread
>>
>>61274199
Explane.
>>
People who say that C++ isn't useful for kernels/drivers just don't know what their talking about.

C++ is great for kernel dev and userspace dev. Languages like C# and Java have no place.
>>
>>61274125
Well that's a refreshment
what if the numbers were stored in a txt file?
>>
>>61274125
Revising this a touch so that it actually solves the problem given instead of just only providing a general solution to problems of the same form
#include <stdlib.h>
#include <stdio.h>
// result is 0-terminated and must be freed by caller
// returns an array only containing 0 if none missing
// sequence must be non-empty
// and in strictly ascending order,
// with first element greater than or equal to "lowest",
// and last element less than or equal to "highest"
// if these assumptions are violated,
// cleans up memory and returns null
// example:
// int sequence[] = {1, 3, 4, 5, 8};
// int *missing = missing_from_sequence(sequence, 5, 1, 9);
// missing would be {2, 6, 9, 0}
int *missing_from_sequence(
int *sequence, int len, int lowest, int highest) {
if (len == 0) return 0;
int *missing;
int mlen = highest - lowest + 1;
missing = malloc(mlen*sizeof(int));
int i = 0;
for (int n = lowest; n < sequence[0]; i++, n++)
missing[i] = n;
for (int j = 0; j < len - 1; j++) {
if (sequence[j] >= sequence[j + 1]
|| sequence[j] < lowest
|| sequence[j] > highest) {
free(missing);
return 0;
}
for (int n = sequence[j] + 1; n < sequence[j + 1]; i++, n++)
missing[i] = n;
}
for (int n = sequence[len - 1] + 1; n <= highest; i++, n++)
missing[i] = n;
missing = realloc(missing, (i + 1)*sizeof(int));
missing[i] = 0;
return missing;
}
int main() {
int sequence[95000];
int count, n;
// numbers accepted from stdin, must be in strictly ascending
// order and between 1 and 95000 inclusive
for (count = 0; count < 95000 && scanf("%d", &n) == 1; count++)
sequence[count] = n;
int *missing = missing_from_sequence(sequence, 5, 1, 9);
if (missing)
for (int i = 0; missing[i]; i++)
printf("%d\n", missing[i]);
return 0;
}
>>
>>61274289
VM'ed languages were a mistake
>>
>>61274289
>Mentioning c#/Java
The reason C++ is shit for kernel/driver dev is because C is a thing.
>>
>>61274289
What kernel has been written in C++?
>>
>>61274310
Wait, no, crucial mistake. Last time I'm fixing this I swear.
#include <stdlib.h>
#include <stdio.h>
// result is 0-terminated and must be freed by caller
// returns an array only containing 0 if none missing
// sequence must be non-empty
// and in strictly ascending order,
// with first element greater than or equal to "lowest",
// and last element less than or equal to "highest"
// if these assumptions are violated,
// cleans up memory and returns null
// example:
// int sequence[] = {1, 3, 4, 5, 8};
// int *missing = missing_from_sequence(sequence, 5, 1, 9);
// missing would be {2, 6, 9, 0}
int *missing_from_sequence(
int *sequence, int len, int lowest, int highest) {
if (len == 0) return 0;
int *missing;
int mlen = highest - lowest + 1;
missing = malloc(mlen*sizeof(int));
int i = 0;
for (int n = lowest; n < sequence[0]; i++, n++)
missing[i] = n;
for (int j = 0; j < len - 1; j++) {
if (sequence[j] >= sequence[j + 1]
|| sequence[j] < lowest
|| sequence[j] > highest) {
free(missing);
return 0;
}
for (int n = sequence[j] + 1; n < sequence[j + 1]; i++, n++)
missing[i] = n;
}
for (int n = sequence[len - 1] + 1; n <= highest; i++, n++)
missing[i] = n;
missing = realloc(missing, (i + 1)*sizeof(int));
missing[i] = 0;
return missing;
}
int main() {
int sequence[95000];
int count, n;
// numbers accepted from stdin, must be in strictly ascending
// order and between 1 and 95000 inclusive
for (count = 0; count < 95000 && scanf("%d", &n) == 1; count++)
sequence[count] = n;
int *missing = missing_from_sequence(sequence, count, 1, 95000);
if (missing)
for (int i = 0; missing[i]; i++)
printf("%d\n", missing[i]);
return 0;
}
>>
>>61274305
This version would work for that: >>61274343
>>
>>61274030
From quickdocs:
If WANT-STREAM is true, the message body is NOT read and instead the (open) socket stream is returned as the first return value.
>>
>>61274343
>>61274368
mein neger
>>
>>61274314
Read my post again.
>>
>>61274322
NT
>>
>>61274399
Will it download the entire file first though?
>>
>>61274444
I did, you are saying C++ is good because C# and Java are shit.

Which is true, but C is better, and people only call "C++ shit for kernel dev" because C exists and is better for it.
>>
>>61273495
best computer science books for python?
>>
>>61274523
>computer science
>python
What? Do you mean a programming book or a CS book?
If you mean CS just get out of here. Go to /sci/.
>>
>>61274558
computer science book s-s-sorry...
>>
>>61274289
C++ is a mess. Don't use it for systems programming. Worthless language.
>>
>>61274508
>I did, you are saying C++ is good because C# and Java are shit.
No, I am not. You have shit reading comprehension.
I said Java and C# have no place because C++ does their job better.

>because C exists and is better for it.
Wrong.
C is not any better at kernel development than C++ is.
Only people who don't actually understand C++ think that.

C++ adds plenty of things useful in any context, including kernels, without adding any overhead that wouldn't be there in C.
>>
>>61274564
They will laugh at you because they don't like CS generally. But this is a programming thread. No serious computer scientist would go here.
>>
File: powershell.png (358KB, 1972x1475px) Image search: [Google]
powershell.png
358KB, 1972x1475px
powershell noob, using v5.1 and only coding for 5+

I am doing some scripting for automatic scheduled backing up of shit
progress is being logged in to a log file

I use alias echo of write-ouput to do shit like this

echo "MOVING THE ARCHIVE..." >> $log_file


recently I realized that I can do just

"MOVING THE ARCHIVE..." >> $log_file


>QUESTION 1
Should I use just that above instead of write-output or its echo alias?

but I feel like its still quite inelegant.
what I would prefer the most is single line where I tell the script to redirect output like in linux bash
but no luck googling, even though it seems possible
but I dont fucking care if its some 20 lines of code, or adds even more shit than >> $log_file
>QUESTION 2
any way to simply told script that from now on, redirect write-output in to specific file?
>>
>>61274474
No. That's the whole point of a stream.
>>
>>61274627
Honestly, where do I learn all this networking stuff, I'm very uncultured desu.
>>
>>61274343
error: invalid conversion from 'void*' to 'int*' [-fpermissive]
missing = malloc (mlen*sizeof (int));
^
>>
>>61274729
Don't compile c code with g++ anon. In fact just uninstall it.
>>
>>61274645
http://cl-cookbook.sourceforge.net/sockets.html
>>
>>61274729
Report it as a compiler bug.
>>
>>61274795
No that's valid. C++ is stupid and doesn't implicitly convert from void pointers. My guess is it's a conspiracy to make using malloc annoying so people would be forced to use the new keyword instead.
>>
>>61274729
hold up, can't you just cast it as an int*?
>>
File: wow anon.jpg (78KB, 884x574px) Image search: [Google]
wow anon.jpg
78KB, 884x574px
>He doesn't live code

https://medium.freecodecamp.org/lessons-from-my-first-year-of-live-coding-on-twitch-41a32e2f41c1
>>
In the context of using libraries in C, what is the difference between -I (i uppercase), -l (L lowercase) and -L when compiling my program?
>>
>>61274816

void *foo = new Foo;
Bar *bar = foo;
>>
>>61274839
anyone else hate this streaming shit?

all my fucking normie friends act like it's the second coming of jesus

YOU'RE WATCHING SOMEONE ELSE PLAY A GAME

GAMING IS NOT A SPECTATOR SPORT
>>
>>61274839
That's some pussy shit, this is live coding:
https://youtu.be/yY1FSsUV-8c
>>
>>61274840
>-I (i uppercase)
Include path
>-l (L lowercase)
library to link
>L
library lookup path
>>
>>61274844
$ cat noanon.cpp
int main() {
void * n = new char;
char * p = n;
}
$ g++ -o noanon noanon.cpp
noanon.cpp: In function ‘int main()’:
noanon.cpp:3:13: error: invalid conversion from ‘void*’ to ‘char*’ [-fpermissive]
char * p = n;


Void pointers need to be cast in C++ anon.
>>
>>61274873
Thanks. In what situation do I only need the include path options without the library or lookup option?
>>
>>61274921
Exactly. I'm displaying what would happen if void* did not need to be cast. It opens a gaping hole in the type system.

C's type system sucked.
>>
>>61274840
To add to this
>>61274873

if you want to compile main.c from say "~/projects/hello" and you're running gcc from that folder, but your program needs to link and include headers from library "foo", located in "~/foo", you would do something like this

gcc main.c -o hello -L ~/foo/lib -l foo -I ~/foo/include

where the last -I is upper case i
>>
>>61274762
>>61274343
Well now it's taking forever to execute if at all
$ . /missing_numbers a.txt 
>>
>>61274948
C doesn't suck, it just doesn't hold your hand and assumes the programmer isn't a retard and can remember what his pointers actually point to
>>
>>61274975
That's what a type system is for.
>>
>>61274948
You can do the same thing with casts though. C++'s type system is still flimsy. If you want type safety don't use C or C++.

Removing implicit conversion from void pointers doesn't really do anything other than force you to use generics and new, and make interfacing with C libraries, especially those with functional programming aspects, a burning pain in the dick.
>>
>>61274816
Yes I know. Bothering C++ programmers make them less effective in destroying the world though.
You can trivially bother them a lot with simple questions. People are suckers for teaching.
>>61274839
Most who do it really really suck. It's a shame. I'd love to actually learn from other programmers.

I can see why good programmers don't though. It'd be easy to get distracted.
>>
>>61275011
>You can do the same thing with casts though
Casts are explicit. It's fine to do dangerous things if you make it clear that what you're doing is questionable.

C++ tried to have a type system. OOP is all about types. However much it succeeded is questionable, but this hole needed to be closed before an attempt could even be made.
>>
>>61274840
>>61274873
This depends on the compiler. It's not C specific.
But it's true for all the ones I use (MSVC, GCC, clang
>>
public int max(int a, int b) {
return new If(
new GreaterThan(a, b),
a, b
).evaluate();
}
>>
>>61275125
God damn. Wow. I guess that would be how eval would work in OOP. What a dumpster fire. I'll stick to Lisp for eval.
>>
>>61275125
lmao what
>>
>>61275149
It reads like lisp tho.
>>
>>61275273
LISP is unreadable too, I agree.
>>
>>61274955
>>61275095
Thanks. I'm using gcc but I think I get it now. If I'm using for example a struct that was defined in 'struct.h' I need to use -I (i) to include it. But, if I'm using some function defined in the 'foo.c' library I need to use the -l (L) and -L options.
>>
File: Java and Programming Penguin.png (32KB, 237x170px) Image search: [Google]
Java and Programming Penguin.png
32KB, 237x170px
What are the best development tools for Java on Linux?
>>
>>61275348
IntelliJ IDEA is bretty gud
>>
>>61275348
vi
javac
>>
>>61275311
Remember if you Google flags you need to quote the -l for instance.
Because Google has exclusion terms denoted by -. So searching gcc -l will get you everything you're not looking for.
>>
>>61275273
Sort of. But the problem is you have to operate on objects. Which means performing operations to alter the "source" to be evaluated is going to be a bitch. You can't just use your typical built in parsing operations and whatnot like you can in lisp with map, car, cdr, set-car!, set-cdr! and shit.
(define (max a b) (eval `(if (> ,a ,b) ,a ,b)))

Also I'm wondering if that has support for evaluating in different environments like r7rs does.

Not to mention evaluate not working on source code and easily portable code makes it an unnecessary bitch for many good uses of eval. But that's going to happen for basically any non-lisp language because only lisps are homoiconic.

Now you have to worry about serialization.

It's still cool though. But cool in an abstract way and not in a practical way.
>>
>>61275348
IntelliJ IDEA or NetBeans. IntelliJ is better but you'll have to buy it to unlock everything, Some people also use Eclipse but it's inferior to netbeans. These all run on JVM itself so you can use them in any OS.

>>61275372
Works well for learning and small stuff but once you get into proper projects with dozens of class files you'll understand why proper IDEs are the preferred option.
>>
>>61275435
Even the free version of IDEA is really good.
>>
/dpt/ have you ever noticed that in C++ implementation files are garbage?
>inb4 all of C++ is garbage
If this is what you have to say about it, kill yourself.
ubigint ubigint::operator+(ubigint const &other) const {
// implementation goes here
}

Why doesn't C++ have a "using typename" or "using class" declaration yet, that you could put in an implementation file to indicate that's the class you're implementing?
It would make this trash so much easier.
using typename ubigint;
ubigint operator+(ubigint const &other) const {
// implementation goes here
}
>>
Why do schools, colleges, bootcamps etc. still teach Java serialization? It's absolutely terrible and fraught with problems and pitfalls
>>
>>61275413
You forgot to mention that some Lisp implementations are native, so "eval" may be compiled to machine code when needed.
For one call like "If" it would be stupied, but scripts being runtime built to native is very nice.
>>
>>61275476
How do you serialize objects without it though? Never done work with Java but serialization in other languages is awesome.
>>
>>61275468
>even more redundant usings
wew
>>
>>61275497
Write a JSON (or whatever encoding you want to use) codec? It's not even difficult.
>>
>>61275468
I agree, that always struck me as odd.
>>
>>61275497
(print (ms:marshal your-bloated-object) some-stream)

then
(ms:unmarshal (read some-stream))
=> your-bloated-object
>>
>>61275517
Then you can only serialize data and not anonymous functions and shit.
>>
>>61275545
If you want to serialize something, turn it into data.
>>
>>61275567
What if code were data?
>>
>>61275468
Maybe it makes symbol resolution harder? C++ already compiles slow as is.
>>
>>61275445
Yes, but IIRC you can't do webdev stuff with it. That's pretty major flaw and you'd be pissed if you had to learn anothe IDE just to do specific programs.

>>61275545
In 95% of cases that's a good thing.
>>
>>61275577
Then we wouldn't be using Java.
>>
>>61275578
if only we had modules
>>
writing a multiplayer blackjack game in node.js, socket.io and bitcoin API
gunna post link to a demo soon
>>
>>61275514
>wew
lad
>>
>>61275409
Holy fuck thank you anon I wasn't getting any hits which is why I posted in dpt in the first place
>>
>>61275589
C++ will never have proper modules even when it gets modules.
Youll still have header files, and even if they manage to get scrapped, the time in will take for them to get completely phased out will not be worth it.
Just hop languages already.
>>
>>61273605

Look at sqlite.
>>
>>61275348
Netbeans will work. I mean, what you need at the end of the day is something that can compile Java code and also has debugging features. Netbeans has that. It also has sample projects you can dick around with if you are curious.

That said, there are other IDEs out there too.
>>
>>61273605
if its a good idea i can collab with you on it
>>
I want to write an app that lets me smoke in front of the computer without my room getting smelly. What language should I use?
>>
>>61275612
I wish using D without GC weren't such a minefield, otherwise I'd have hopped over years ago.
>>
>>61275348
eclipse. hands down.
>>
>>61275704
Why use a dead language that doesn't function well without a GC, when Rust exists?
>>
>>61275697
just buy a vape and use rust
>>
>>61275704
D's GC is relatively pleasant though.
You can control it, and get around a lot of invoking so you dont have to bother in the first place.

But not that you really need to, desu. Its never fucked me and i do mostly games.
>>
>>61275740
Or you could just use a non-dead language that doesn't have a GC that you have to control or work around.
>>
>>61275723
Rust changes a lot more than just having modules.
>>
>>61275758
So it's even more superior to D.
>>
>>61275751
D is the best current language for games.
Rust is slow, everything is 10x more tedious, and the community care more getting more people in their cult then the actual language.

Im sick of C++'s shit.
My functional languages are currently too slow as well.
>>
File: bug.png (3KB, 181x100px) Image search: [Google]
bug.png
3KB, 181x100px
I'm doing the CS50 course, im stuck on the pset2 exercise "crack".

I just trying to get the first two characters of the command line argument to determine the "Salt".

I can't get this to work, when i run the program i get no errors but the console won't print the value of the salt variable, its just empty.
>>
>>61275758
What exactly does Rust change?
And please dont bring up safety, im sick of that word solely from Rust.
>>
>>61275843
Safety is one thing, but the BC makes it really awkward to write some things
>>
>>61275843
>And please dont bring up safety
That's it, oh, and it managed to introduce a syntax that's even uglier than c++.
>>
>>61275843
Traits (if only it had real HKTs)
Borrowing
Lifetimes
Safer concurrency
>>
>>61275823
so
$ ./nigger hello there
argv[0] = "./nigger"
argv[1] = "hello"
argv[2] = "there"

you want "he" as `salt'?
>>
>>61275810
>>Im sick of C++'s shit.

I don't think the industry will ever shake it off. It doesn't help that C++ has had pretty active development over the last few years.

I don't mind C++ too much, however.
>>
>>61275873
UDA's
I guess concurrency is fair but its not too much harder to sync things.
>>
File: bug2.png (2KB, 256x26px) Image search: [Google]
bug2.png
2KB, 256x26px
>>61275874
yeah, i literally use nigger as a test word before lmao
>>
Is there a float version of stdint.h?

I'm optimizing some code and I'd like to replace a divide with some disgusting bit hacks for speed, but I'm scared to do it on double for portability reasons unless I can be sure that the double is indeed an ieee double.

  0 double xoroshiro_random_flonum() {
1 const uint64_t n = next();
2 return ((double) n) / UINT64_MAX;
3 }
>>
>>61275906
> I don't think the industry will ever shake it off.

We need a better language that can also easily run C++ libraries, that would kill C++.
>>
>>61269971
>I don't feel good about sending women, who I was raised to protect and respect, into this war. I also personally don't like the idea of women being police officers, soldiers, surgeons, or firefighters, even though it's not up to me to decide what they do for a living.
I hate this.
I don't want to have women be put above men for their gender. There's arguments around women being unqualified for jobs like firefighting and the likes but programming isn't like that at all.

Also you rarely find men arguing for the reverse. To lock themselves out of jobs. Not to mention the way they miss how women having less jobs to choose from makes them less competitive in the market overall (if you have less options you can't argue for as high a pay for instance).
Horrible comments.
>>
>>61275927
try dis
#include <stdio.h>
#include <string.h>

int main (int argc, char *argv[]) {
char salt[3];
strncpy (salt, argv[1], 2);
salt[2] = 0;
printf ("%s\n", salt);
return 0;
}
>>
>>61275956
Some men are afraid of becoming obsolete in the job market. It's inevitable though, whether the competition comes from women or robots.
>>
>>61275823
Your code is garbage, but try printf("Salt: %s\n", salt.c_str());
>>
>>61275952
D can easily link with C and C++.
It still failed.
>>
The genius of C++ is name mangling, it ensures nothing will ever dethrone C++ by calling C++ code
>>
>>61275971
Yeah that works, thanks man. Now i just got to figure out how it works.
>>
>>61276039
You can demangle
>>
>>61276039
Not even C++ can call C++ code. Good luck linking object code from different compilers.
>>
>>61273495
YOUR WAIFU A SHIT
>>
>>61276056
printf doesn't know how to format a string object. So either use a c-style string (char array) or call c_str on your string to get a c-style string. Or just use streams.
>>
>>61276071
YOUR HUSBANDO A SHIT
>>
>>61275980
I don't think it's that at all. This guy doesn't have any chance of losing his job to women really (unless his company deals with him for political reasons). He may be a Java monkey but he's high enough to not be all that affected.

It's a genuine protective concern I think. My mom has been working with software for over two decades now. She does fine. But she was a project lead for a while and she didn't back down on her responsibilities ever (meaning she just took on more and more) so like everyone who does that she got horribly depressed and had to take a long leave.

I think his perception is that women would end up there way easier and he doesn't believe programming is a healthy career choice for women. I don't think he's right to generalize all women like this even if he would be right. He should take a more nuanced view. He's not the only one at fault for this. Society as a whole is terrible at this so it's not as bad as he makes it out to be.

I wouldn't want to work on a project with a woman under him though. That'd be stupid unfair if he just throws her work at me. What I'm worried about with PLs like this guy is just that.
>>
>>61276071
>>61276081
YUOR LENGUAGE A SHIT
>>
>>61274864
>GAMING IS NOT A SPECTATOR SPORT

I hate this argument.

What if I don't own the game, but I'm still interested in it?
What if I don't even own a system that this game runs on?
What if the person I'm watching provides more value than just playing? (i.e. they're the best at the game, or they're entertaining, or they're further ahead than you are in the game, etc.)

There are lots of reasons why let's plays and now steaming are so big. And gaming has always been a spectator sport for many.
>>
>>61274972

Sorry for the late response, hope this still helps.

Here's your problem. I should've told you how to actually invoke the program. It's ignoring your file and waiting forever for input from stdin.

To give it stdin input, you could type, but that would also take forever. Instead, try this:

./missing_numbers < a.txt


That will pass a.txt to the program as its stdin stream.
>>
>>61276117
This
For me I like blind LPs because seeing how other people react to things lets me vicariously relive my own reactions when they're the same, and when they're different, it expands my perspective and gives me something to think about while I laugh
>>
>>61275995
Maybe because they started changing it after 2007 again?
>>
>>61276154
It's OK, D3 will finally be good :)
>>
>>61276039
>>
>>61276136
>seeing how other people react to things lets me vicariously relive my own reactions

Yep, definitely.
That's also a reason why reaction channels happened.
>>
>>61276136
Reactions to what? Killing the same enemy for the 100th time?
>>
File: old_hag_langs.png (173KB, 600x355px) Image search: [Google]
old_hag_langs.png
173KB, 600x355px
>>61273566
Fortran.
>>
>>61276184
Please refer to the list of other possible reasons outlined in >>61276117 if that one doesn't fit the content you have in your mind.
>>
>>61276168
beautiful

>tfw you'll never be an arch-mage fully initiated in the mysterious of arcane c++ lore
>>
>>61276064
This hurts me so much. But I do it.
>>
>>61276184
No.
Plot twists.
Interesting design choices.
Genuinely evocative moments.
Anything else that can make a vidya truly artistic.
Which, by the way, it can be.
See for example:
* Mother 3
* Lisa: The Painful RPG
* Yume Nikki
* Undertale *dodges incoming meme missiles* nothing personnel kid *teleprots behind u* *unsheathes fedora*
* OFF
* Sonic Dreams Collection
* Journey
* Legend of Zelda: Majora's Mask
* Spec Ops: The Line
* The Company of Myself
* Eversion
* Braid
* Binding of Isaac: Rebirth/Afterbirth/Afterbirth+
>>
>>61276136
I like streams, but it all depends on who streams. I got into this one community and spent about 6 years there already, and it keeps going because it's the same people with similar motivations, few changes and no bullshit.

It is fun for instance to see someone play something they don't understand well. I was watching some Illusion of Gaia stream just a few weeks ago and this guy reached a point at which one of the characters just turned into a flower and fucked off. That was so out of nowhere he couldn't stop laughing about it.
>>
>>61276380
I just use it to alleviate my social deprivation
>>
Advice on how to meme someone off the face of the earth?
>>
>>61276411
>>>/adv/
>>
>>61276411
Teach them haskell and give them a job.
A job where they work in asm.
>>
File: 從這地球上消滅掉這meme.jpg (290KB, 512x502px) Image search: [Google]
從這地球上消滅掉這meme.jpg
290KB, 512x502px
>that absolute state of dpt
>>
>>61276411
ask /pol/, they drove Shia to the point of insanity, he even got arrested earlier today.
>>
>>61276474
>hehehe le /pol/ exdee
>>
>>61276498
see, you'll fit right in.
>>
>>61276438
>use haskell knowledge to build circuits because circuit design is a pure and stateless functional programming language and the canonical physical implementation of lambda calculus
>hook the circuits up to the processor's alu to extend it with new instructions
>write the assembly to call these instructions
>solve every programming problem in this way
problem?
>>
>>61276474
Today? That's cool, don't even care about politics.
>>
>>61276474
Again? Didn't they already get him arrested?
>>
>>c++::decltype
literally whats the use case lads
other than obfuscating code with arcane evaluation rules
>>
>>61276975
the stl wizards need it I guess
>>
>>61276975
>not obsfucating the code with arcane evaluation rules
What do you want to lower programmers salary or something?
>>
>>61276990
Necromancers rather. They're playing in dead language design.
>>
>>61277018
c++ is really paygrade moat: the language isnt it
>>
>>61276975
Personally I think decltype(v.size()) looks better than vector<whatever>::size_type
Also if you have a template function whose parameter needs to contain a name but its type is unknown then you could do something like this:
template <typename T> decltype(T::foo) &get_foo(T);
>>
>>61277039
Excuse me:
template <typename T> decltype(T::foo) &get_foo(T &);
>>
>>61276975
if you need to declare e.g. a vector inside your function then auto won't help much
>>
File: based_firefox.jpg (234KB, 2048x1536px) Image search: [Google]
based_firefox.jpg
234KB, 2048x1536px
I'm writing some Selenium web driver scripts that register and verify Reddit accounts. I want to run this on a hosted server; is Selenium my best bet here?
The plan is to build and maintain a database of active accounts that anyone can use for the purpose of anonymity.
>>
do somewhat advanced programmers read someone else's code like an open source project for example like a book

or do they go line by line, back and forth
>>
>>61276975
it shines with complex template crap, saves a lot of typing
>>
>>61275359
>>61275435
Since it's not in linux repos, where do you get this shit from?
> IntelliJ IDEA
>>
>>61274839
>hardware node.js programming
haha what the fuck
>>
File: google.jpg (360KB, 1002x563px) Image search: [Google]
google.jpg
360KB, 1002x563px
>>61277262
>big browser is watching

that's fucking brilliant
>>
Picture this, /dpt/.

Your operating system is now Python.

I don't mean it's written in Python. I mean your operating system literally IS Python.

As in, you press the power button, the bootloader takes however many seconds to do its thing, and this is what you see next:

Python OS 1.0 (default, Nov 17 2016, 17:05:23)
Type "help", "copyright", "credits" or "license" for more information.
>>> _


The system info line is omitted because Python itself is the system.

All the libraries included with the interpreter that have to make use of anything outside the simple shell environment -- filesystem, networking, graphics, audio, etc -- are fully functional and have been reimplemented as unhosted/freestanding. There is no kernel. Python is the kernel. These libraries now talk directly to the drivers.

The exit() function has, of course, been repurposed to shut down the computer.

You can install new third party libraries using a package manager provided as a new standard library. Of course, the package manager must be invoked from the Python interpreter, because there's literally nothing else.

You can upgrade the OS, but here's how it has to be done. There's a dedicated upgrade partition. You -- IN PYTHON -- have to:
>download the upgrade package
>write it to the upgrade partition
>call a function which will:
>>give the bootloader advance notice you want to boot from the upgrade partition next time
>>reboot the computer

Now.

Given all this information.

How fast do you kill yourself, and with what?
>>
>>61277262
>the billboard says "big browser is watching" in reference to chrome
>the billboard was put up by mozilla
>it is a billboard
does anyone else see the irony here
>>
>>61277599
That's not too bad. I'll be waiting months for it to finish though.
>>
>>61277618
what's the irony
>>
>>61277618
billboards don't track their readers
>>
>>61277599
So kind of like Apple II but with Python instead of Basic?
>>
>>61274183
So, since I posted this, only one faggot has tried to crash it. 3/10 apply yourselves.
>>
I made a "program" that runs the compiler with my usual settings
How can I make it start from everywhere regardless of where I start the console
Am on windows
>>
>>61277843
Make a new directory for scripts
Put it there
Add that directory to your path environment variable in the settings menu
>>
>>61277873
Thanks
>>
Can someone help me out?

I'm a complete fucking beginner with shell scripts and I need to write one to monitor changes in a directory. I know about inotify-tools and I can more or less grasp that concept but I also need to output the changes to a log file, how do I go about that?
>>
>>61277618
I honestly don't
>>
>>61277843
Specify the path to the compiler explicitly? (C:\Program.....\cl.exe)
>>
>>61277939
Output>>file
Let's you append file with what'd normally be printed. You can use that to log.
>>
>>61278043
Nah I wanted to have it like gcc is
I just have to switch the console to the correct folder and enter qgcc <filename> and it just werks with >>61277873
>>
File: Winston Linux.jpg (147KB, 1380x543px) Image search: [Google]
Winston Linux.jpg
147KB, 1380x543px
Learning Haskell
>>
>>61278086
>Learning Haskell
I'm so sorry.
>>
Anyone here have experience with Pygame? If so would you kindly point me in the right direction of where do learn? I am currently learning the basics of python and a little more than half way through
>>
>>61278174
No worries m8, thanks for the condimentdolences
>>
>>61278076
Update your (or the system) PATH to include the folder qgcc is in.
>>
>>61278086
need help?
>>
lisp is garbage
you can't even #'read a simple file which has an arbitrary number and then eof.
>>
>>61278058
Eyy that helped

Now is there any way I can actually make the log...Detailed?

It's outputting the file/directory which was changed in some way but not really specifying what and why.
>>
>>61278503
don't blame lisp for your incompetence
>>
>>61278556
try it, nigger
>>
>>61278595
you should probably show exactly what you are doing through code
>>
File: 287902.jpg (32KB, 225x350px) Image search: [Google]
287902.jpg
32KB, 225x350px
When will this thread stop being shit? I mean, I fucking cut myself just looking at the code here, let alone the comments.
>>
File: 00mosley3.jpg (25KB, 285x310px) Image search: [Google]
00mosley3.jpg
25KB, 285x310px
>Working with strings in C
>>
>>61278775
It never will.
>>
>>61278803
C is a disservice to intelligent programmers. It has almost 0 features that a modern and intelligent programmer uses to be productive. Since C is such a timesink, it's popularity is falling more than any other languages in the market.
C is dying and it should die ASAP. C programmers are actually retards in general. C is a small language to grasp, exactly the kind of shit that makes things retard friendly.
C has no advanced features like C++ does.

But as a newfag you are kinda in the right direction. C is for newbies. Think of it this way:
During ancient times, counting to 10 was a big deal and a person who could count to 10 was considered to be "wise".

Fast forward a few century counting to 10 is so trivial we teach this to toddlers. Now toddlers appreciate the vast "knowledge" of counting to 10 while matured brains are busy with modern technologies.

C is from stone age and the people who still preach it is like overgrown toddlers that can't learn advanced things. C is for lesser programmers.
C doesn't have delegates
C doesn't have resizable arrays
C doesn't have strings
C doesn't have string concatenation
C doesn't have namespaces
C doesn't have exception handling
C doesn't have closures in the standard
C doesn't have unit tests
C doesn't have Function overloading
C doesn't have memory safety of any kind
C doesn't prevent memory exploits and has no bounds and runtime checks
C doesn't support dynamic method loading/creating
C doesn't even have generics and templates
C doesn't have meta programming
C doesn't have mixins
C doesn't have higher order functions
C doesn't have contract programming
C doesn't have inner classes
C doesn't have function literals
C doesn't have array slicing
C has a very limited support for implicit parallelism
C doesn't even have string switches

C is a cancer that plagues the modern software industry
>>
>>61278842
A lot of those features are shit
>>
>>61278807
I mean fucking pajeets I can hire for half a pound/h write more readable and better optimized code then this self-thought shitspawn here and let me not get to the comments themselves.
>>
File: 1477304642279.jpg (9KB, 115x115px) Image search: [Google]
1477304642279.jpg
9KB, 115x115px
>>61278842
>Working with C with /dpt/ as your guide
>>
>>61278842
>C doesnt have inner classes
>What is a struct pointer the post
>>
whats the best python lib for breaking/distorting image files? I was using processing/java but I need something faster, to execute on a raspberry pi
>>
>>61278909
Not an inner class.
>>
clfag here, how do bidirectional streams work
if I write to it, then reading it will give back what I wrote?
>>
>>61278950
How?
It clearly is
>>
>>61274816
>C++ is stupid and doesn't implicitly convert from void pointers.
That's not stupid.
In fact C is stupid for doing so.
>>
>>61278965
Go look up what an inner class is before posting.
>>
OH MY FUCKING GOD THIS THREAD
>>
>>61279023
Who cares where it's declared LOL you annoying brat
>>
>>61278931
>need something faster
>python
>>
>>61275468
It's because C++ still uses the header brain damage from C.
The solution is modules, although the committee will probably fuck it up like usual and not actually solve anything big with it.
>>
I was looking at: https://gamedev.stackexchange.com/questions/23312/45-slopes-in-a-tile-based-2d-platformer

And saw the formula:
y1 = y + (x1 - x) * (v / u)

Where:
x1: object x coordinate
y1: object y coordinate
x: tile x coordinate (bottom left)
y: tile y coordinate (bottom left)
u: tile width
v: tile height


I've also been trying too make sense of the part of the article that has the Mega Man X image: https://www.gamedev.net/articles/programming/general-and-gameplay-programming/the-guide-to-implementing-2d-platformers-r2936

I was playing around with several combinations, and couldn't get anything to work as expected.

I don't have any sloped tiles either, I'm not sure how to incorporate those into SDL. However, shouldn't this formula work regardless of whether it is sloped or not?

I think that the issue that is confusing me is that the origin x,y coordinates are from the bottom-left, whereas in mine the origin x,y coordinate are from the top-left. What would I need to change around in order to have a working formula?
>>
I was looking at how to create a directory using C if it doesn't already exist. I got the following answer and it works but why was it necessary to create and use a struct?
struct stat st = {0};

if (stat("./temp/", &st) == -1)
{
mkdir("./temp", 0777);
}
>>
Stupid question but sqt are stupider.

When should you use * in C++? For instance when passing a pointer to a function, you don't prefix it with *, but when accessing a member through it, you also don't need *. I thought * meant you get the value (which in this case would be an object) so why don't you need it when accessing members i.e. using the -> operator?
>>
>>61278842
>C doesn't have delegates
function pointers
>C doesn't have resizable arrays
realloc
>C doesn't have strings
char buffers
>C doesn't have string concatenation
strcat
>C doesn't have namespaces
true that
>C doesn't have exception handling
true that
>C doesn't have closures in the standard
true that
>C doesn't have unit tests
fprintf stderr
>C doesn't have Function overloading
true that
>C doesn't have memory safety of any kind
do it yourself
>C doesn't prevent memory exploits
yes it does
no network support
>and has no bounds and runtime checks
do it yourself
>C doesn't support dynamic method loading/creating
oop is shit
>C doesn't even have generics and templates
macros
>C doesn't have meta programming
macros
>C doesn't have mixins
oop is shit
>C doesn't have higher order functions
function pointers
>C doesn't have contract programming
do it yourself
>C doesn't have inner classes
oop is shit
>C doesn't have function literals
true that
>C doesn't have array slicing
memcpy
>C has a very limited support for implicit parallelism
true that
>C doesn't even have string switches
true that
>>
>>61279112
obj_ptr->member
is pure syntax sugar for
(*obj_ptr).member
>>
>>61279108
Use access() instead.
>>
>>61279131
What does the latter do? Is it a cast?
>>
>>61279108
Because stat() takes a struct stat as an argument. Read the man page to understand what it does.
>>
>>61277039
Just use C++14 automatic return type deduction.
>>
File: 1487373386364.png (217KB, 422x538px) Image search: [Google]
1487373386364.png
217KB, 422x538px
can someone recommend me a good book about OOP?
If it have a ebook is better c:
>>
>>61279108
try giving it a NULL and see if it still works theres a good chance it will
>>
>>61279180

(*obj_ptr) // follow the pointer to reach the object
(*obj_ptr).member // follow the pointer, then access the member
obj_ptr->member // follow the pointer, then access the member

The . operator is used for accessing a member. -> is just a shorthand form for dereferencing and then accessing a member.
>>
>>61279112
It can be useful for if you need to do some transaction on a struct but want to be able to back out of it:
int do_reversible_work(struct my_struct_type *s) {
struct my_struct_type t = *s;
for (int i = 0; i < num_of_tasks; i++)
if (!mutative_tasks[i](&t)) return 0;
*s = t;
return 1;
}

Or when iterating a string or other null-terminated list:
void do_string_work(char *c) {
for (; *c; c++) {
>>
>>61279209
It will probably be a problem when the directory does exist most likely resulting in segm fault.
>>
>>61279194
Can you do that if you're declaring a prototype in a header?
>>
>>61279213
tl;dr
It's literally the difference between "your" and "you're", if you can learn said difference, maybe programming isn't for you.
>>
>>61279274
No, probably not.
>>
>>61279262
It might check for NULL but it also might always return -1 in that case
>>
>>61279274
Although, I don't think declaring only a template function prototype is actually valid.
>>
>>61279302
Which either way is wrong behavior for what he wants to do.
>>
File: icon.gif (59KB, 384x384px) Image search: [Google]
icon.gif
59KB, 384x384px
How hard would Haskell be to learn if my first language was Scheme so mutability and side effects have always been weird concepts to me that felt unnatural?

I mean they make more sense in an iterative language but w/e
>>
>>61279314
Well thats why he should test it
I havent found anything in the manual that says something about it
>>
>>61279309
It actually is. Template classes are the ones you can't just declare without fully defining.
>>
>>61279319
Haskell is nice to learn, try the wikibook
From Scheme it shouldn't be so bad
https://en.wikibooks.org/wiki/Haskell

There's also this
https://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours
>>
>>61273542
>he doesn't use CentOS

fuck ubuntu, that shit breaks all the time
>>
>>61279334
But can you provide the definition of a template function in a source file while having it's declaration in the header file?
I don't think it's possible, considering the way templates work.

So what's the use for declaring template function prototypes? you can never define them.
>>
>>61279346
In my experience it doesn't break unless you fuck around with it way more than you need to do to optimize your user experience
>>
File: 1499505885089.jpg (313KB, 936x646px) Image search: [Google]
1499505885089.jpg
313KB, 936x646px
>>61273495
who /elxier/ here?
>>
>>61279331
I'm pretty sure its a problem. Fuck me, if I wasn't in my last minutes awake I would test it myself but I want to go to sleep.
The function stores the info it gathers on the struct * you give it, if the dir doesn't exist, which is what he wants to check, then if it returns -1, if it does right away then NULL will work, if the dir exist, then it will need memory to store the data and it doesn't have it when you pass NULL. When you pass by address a staticly allocated struct stat it will be alright.
>>
>>61279373
>But can you provide the definition of a template function in a source file while having it's declaration in the header file?
Yes actually.
class has_tempfunc {
public:
template <typename T> void tempfunc(T);
};


template <typename T> void has_tempfunc::tempfunc(T t) {
>>
>>61278931
Pillow.
>>61279047
If you don't have any idea about what you are talking about, better shut up.
>>
>>61279375
i have more experience than you then.

their "LTS" branch is bullshit compared to a standard CentOS release in terms of stability
>>
>>61279467
ubuntu, and debian in general are designed from the ground up to be a desktop user OS, general purpose "universal" OS. CentOS is designed for work/server.
>>
>>61279467
>i fuck around with it way more than i need to do to optimize my user experience then.
ftfy
regardless centos seems cool, i didn't install it because it's short for community enterprise os and why would i need an enterprise os i am not an enterprise i am an individual
>>
PERFORMANCE OF FLOATING POINT ADDITION VS SUBTRACTION

WHEN YOU CAN CHOOSE (UNIFORM VARIABLES IN A SHADER)

IS IT BETTER TO HAVE
>ONLY ADDITION
OR
>HALF AND HALF ADDITION AND SUBTRACTION
OR
>MORE ADDITION THAN SUBTRACTION
>>
>>61279524
DO YOU SEE THE KEY ABOVE YOUR LEFT SHIFT
DO ME A FAVOR AND PRESS IT AND SEE IF A LITTLE BLUE OR GREEN LIGHT TURNS OFF ANYWHERE ON THE KEYBOARD
>>
>>61279524
just rewrite everything so it is in terms of a subtraction operation, my dude
>>
>>61279555
I HAVE IT MAPPED TO ENTER

>fn+caps toggles caps lock
>>
>>61279524
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
>>
How can I talk directly to the graphics card
I just want to tell her how much I like her
>>
>>61279611
i don't think it deals with what i'm asking about

does hardware tend to be biased to have more addition and/or fused multiply-add than subtraction and/or fused multiply-subtract circuitry?

i think when i played around with an offline shader editor it generated a shit ton of fused multiply-add so i guess i should prefer addition?
>>
>>61279624
Women are not allowed in internet. You need to go.
>>
>>61279624
openCL
>>
File: 1476495249309.jpg (32KB, 419x350px) Image search: [Google]
1476495249309.jpg
32KB, 419x350px
>>61279662
I'm a cute 2D anime girl though
That can't count
pic related
it's me reacting to your post
>>
>>61279414
What? But how?
That doesn't make any sense!
>>
>>61279660
Since there are no 'unsigned' floating points numbers, all adder circuits must have a complementer for the sign bit, and after that it's the same circuitry for adding and subtracting.
>>
>>61279699
aren't we all?
>>
>>61279796
so a gpu would most likely use the same circuitry for addition and subtraction, and it probably doesn't matter if you use only addition, half and half, or only subtraction?
>>
File: 1487912401609.jpg (4MB, 2500x3500px) Image search: [Google]
1487912401609.jpg
4MB, 2500x3500px
>>61274523
>>
>computers are dangerous
>computers shouldn't do anything
Haven't haskell nerds ever heard of a pen and paper? Like just step away from the keyboard.
>>
>>61279858
>c++
edgy
>>
>>61274462
Show source
>>
>>61279858
not gonna lie, that's a pretty good reading list
>>
Haskell allows the computer to do anything. Its just a statically typed functional programming language thats all. Nothing mystical about it.
>>
>bash node.js because lefuckjavascriptmeme
>try it
>it's actually pretty cool
>>
>>61273566
>the hot new language
crystal or sthg
>>
>>61280010
>dynamically typed
trash.exe
>>
>>61280010
Go back to your containment thread.
>>
>>61279995
Haskell is sacred
>>
>>61280042
>Haskell is sacred
Yeah, to people who doesn't care about performance.
>>
>>61280089
You mean people who aren't obsessed with video games?
>>
File: computer_frustration.jpg (384KB, 3000x1996px) Image search: [Google]
computer_frustration.jpg
384KB, 3000x1996px
Fuck I want to learn C but why is it so unpleasant to work with
I used to think it's just because it's old, but Pascal is even older and has much nicer syntax
It's all in the terrible small details and design decisions
>>
>>61280104
Learn Forth. It has very simple syntax really appealing to lispers.
>>
>>61280104
>It's all in the terrible small details and design decisions
What exactly are you complaining about?
A lot of the weird little details in C come from the fact that when they first standardised it, they were just standardising existing common practice, even if it didn't really fit a wholly consistent design.
That's why there are some oddities like gets, SHRT_MIN, and a bunch of others.
>>
>>61279709

First one says, for every unique combination of types, following this pattern, used to invoke this name, ensure there shall be a corresponding block in the program text, but don't define it yet.

Second one says, for all blocks in the program text hence ensured, define them thus.
>>
>>61280164
personally I prefer SHRT_MAX
I like to imagine it is short not for "short max" but for "shart max"
As in an integer constant representing the maximum capacity of a C-tard's briefs to contain sharts
>>
>>61280238
USHRT_MAX
>>
How do I make it so that I don't have to source another file for the data?
#!/usr/bin/clisp

; trip money management script

(defun proper? (args)
(and (>= (length args) 2)
(destructuring-bind (cmd $ &rest ?) args
(declare (ignore ?))
(and (or (string= cmd "add")
(string= cmd "del"))
(parse-integer $ :junk-allowed t)))))


(when (proper? *args*)
(let* ((file ".amount") (.amnt (open file)) (money (read .amnt)))
(close .amnt)
(with-open-file (.amnt file :direction :output)
(let ((out (make-broadcast-stream .amnt *standard-output*)))
(format out "~d~%"
(+ money
(destructuring-bind (cmd $ &rest ?) *args*
(declare (ignore ?))
(let (($ (parse-integer $ :junk-allowed t)))
(cond ((string= cmd "add") $)
((string= cmd "del") (- $))
(t 0))))))))))
>>
>>61280164
Malloc stuff, typedefs, having to declare function prototypes on top of the file, multiple meanings of static, anything related to headers
Also some things not intrinsic to the language like makefiles
They're not necessarily bad things but man do they make my existence miserable
And I really want to learn C because I want to do low level shit so I gotta hang on and pull through somehow
I wish I hadn't learned higher level languages before C, because then I would probably think nothing of these things
>>
>>61280274
fucking heavy duty briefs
m9
>>
>>61280098
>You mean people who aren't obsessed with video games?
No, the opposite in fact, people who are obsessed with video games, generally care about performance.
>>
File: 1468168125283.jpg (5KB, 200x200px) Image search: [Google]
1468168125283.jpg
5KB, 200x200px
>>61280369
Am I being rused right now or is English your second language?
>>
>>61280369
Not him but that's what he said
He said that people who aren't obsessed with video games don't care about performance
>>
>>61273517
>Puffy vulva
>>
>>61280402
>Am I being rused right now
are you positing in a /dpt/ thread?
>>
>>61280310
>Malloc stuff
That's pretty core to how C works. You manage your own memory.
>typedefs
You don't really need to use typedef a whole bunch.
I know people complain about how it's just an alias, and not actually a new type in any sense.
>having to declare function prototypes on top of the file
Reorder your functions, then. You should only need prototypes in header files, or if you're doing mutual recursion.
>multiple meanings of static
A common and valid complaint. The C standards committee is averse to adding too many keywords, so they reuse shit a bit too much, with static being the worst.
>anything related to headers
That's how shit was done back then, and it's too far late to do anything about it now.
They're not that hard to deal with, though.
>Also some things not intrinsic to the language like makefiles
That's not how shit was done back then, and I still don't think a language like C really needs one.
C is meant to be able to linked with other languages and hand-written assembly. I can't imagine a way that a truly portable implementation of this could exist for C.
>>
>>61280402
>>61280403
So, what you are saying is that people who are obsessed with video games are arguing for what 99% of /g/ would argue for(as long as it doesn't involve video games)?
>>
>>61280463
No, I'm calling you a faggot.
>>
>>61280481
So, people who advocate for performance are faggots.
I must be confused, I never intended to post in a /wdg/ thread.
>>
>>61280494
Nobody gives a shit about your vidya
>uh you cant write a 60fps 4k game in it??? lol???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
>>
who /dehydrated/ here?
>>
stop hating node.js
>>
>>61280545
>Nobody gives a shit about your vidya
Sure, it's just the largest, multimedia business in the world, overtaking both music and movies, combined, but you made a meme post on /g/, so it must be true.
>>
>>61280552
/constantly having to pee from trying to balance out excessive amounts of coffee/ reporting.
>>
>>61280571
Fucking knew it.
Everyone in this thread knows it.

Whenever someone like you complains about performance, it's ALWAYS because you think everything is about your fucking video games.
>>
>>61280589
>it's ALWAYS because you think everything is about your fucking video games.
No it isn't, just pointing out that "muh vidya" isn't a valid argument against performance.
>>
>>61280589
haskell is shit regardless of performance lol
>>
>>61280605
>against performance
Ah, when someone doesn't ruin everything just to make special room for what you want, it's AGAINST you.
Haskell is not a slow language by any means, it simply isn't at the speed of C and such.
Haskell is a great language.
>>
New thread: >>61280629
>>
>>61280642
>frog
common, man
>>
>>61280630
>Haskell is not a slow language
Depends entirely on your frame of reference, and the fact that video games makes haskell look like a snail in molasses, really says something.
>Haskell is a great language.
Sure, that's why it's so widely adopted
>>
>>61280445
>That's pretty core to how C works. You manage your own memory.
Nah my problems with that are much more superficial.
I just wish I could do something like
var something = new(thing);
instead of
struct thing something = malloc(sizeof(thing));
>You don't really need to use typedef a whole bunch.
>I know people complain about how it's just an alias, and not actually a new type in any sense.
What I don't like about it is that there are so many ways to use it, like naming only the typedef and not the struct, naming the struct thing_p and the typedef just thing, or not using a typedef at all and just struct thing everywhere.
>Reorder your functions, then. You should only need prototypes in header files, or if you're doing mutual recursion.
I know, I would just like to have this kind of thing be automatic like in newer languages.

I'm just too fucking used to languages like Java, C# and Go. I'm sure I'll get used to the C way of doing things eventually, but man it's gonna be such a pain in the butt until then.
>>
>>61280726
>I just wish I could do something like
>var something = new(thing);
>instead of
>struct thing something = malloc(sizeof(thing));
but you can
>>
>>61281236
You mean by using macros? I know it's possible, but then I wouldn't stop there and would end up turning the whole language upside down with macros
>>
>>61280726
learn C++
>>
>>61281476
Many of my gripes with C are still in C++, and it introduces many more. I intend to learn C++ eventually, but I want to learn C++ eventually, but I want to learn C before it.
>>
>>61281525
>I intend to learn C++ eventually, but I want to learn C++ eventually, but I want to
I'm retarded, sorry
>>
>>61281525
i didn't read all your your gripes, but modern C++ is quite different than C besides the syntax, and for example you can do auto something = new thing();
>>
>>61281444
>>61281236
Also I don't think you can do var
You could use define it as auto in C++ but not in C
You could use void* I guess but that's just retarded
>>
>>61281623
so you want C but no types
good bye
>>
>>61282149
>C but no types
I said I want basic type inference you retard
>>
>>61282191
then don't use C
>>
>>61282478
Sadly there's no running away from C, I'll have to put up with its bullshit until I get used to it
Thread posts: 330
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.