[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: 332
Thread images: 20

File: 1374004101205.gif (1022KB, 297x190px) Image search: [Google]
1374004101205.gif
1022KB, 297x190px
What are you working on, /g/?

Old thread: >>59371757
>>
>>59374952
First for all rust shills must die
>>
Haskell
, Lisp
, C
, C++
, D
, D++
, F#
, Rust
>>
A systems language with dependent types. Still trying to decide how to handle resources and effects. Leaning toward algebraic effects.
>>
>>59374970 (NSA paid agent)

C apologists are NSA shills plain and simple. Rust makes it harder to produce vulnerable programs as it actually implements safety precautions like Bounds checking, dangling pointer prevention, data race prevention, lifetimes etc. This is against the interest of the NSA and so they are shilling C so that people continue to produce exploit prone, unsafe and vulnerable programs.

Ignore the NSA/C shills. Programming in C should be banned and outlawed.
Say no to security exploits, say no to the NSA. Your data and your privacy is worth preserving.
>>
>>59374973
Haskell a shit
>>
>>59374952
Actually starting those MIT lectures in the meme image, lisp is such an unreadable language though so it's a struggle.
>>
>>59374982
>old copypasta
CIA niggers are easy to spot.
>>
>>59374982
>t. Wincuck
>>
>>59374982
Youre trying way too hard
>>
>>59375011
Nice try, CIA. People are more careful about your exploits and 0days

Say NO to the three letter agencies
>>
Any good resources on session types that relate them to linear types?
>>
>>59374982
No one cares about your Japanese dragon dildo knockoff rendering software.
>>
>>59375012
I don't use w*dows
>>
There is no times you would want a program to crash
>>
>>59375042
If you don't care then why are you breaching my privacy and exploiting our 0days, CIA?
>>
>>59375009
I like Lisp, but don't force yourself to slog through something you find painful. I will say the prefix notation gets easier to read after awhile.
>>
>>59375029
http://www.tedunangst.com/flak/post/heartbleed-in-rust
How will he ever recover?
>>
I looked at the memory allocator written in Rust and it was absolutely trash, inefficient as fuck and proposed a bunch of "nice features that memory allocators don't normally have" which were actually just shitty features nobody needs that make it impossible to implement efficiently (meaning they were just a byproduct of the naive slow implementation).
I tried to contribute but the build process was a nightmare, errors in dependencies because it relied on a package that purposely used versioning such that they can add/remove features at a whim.
Rust is not ready for kernel development.
>>
>>59375066
Nice try FBI
>>
>>59375073
From the link:
>Interestingly, despite the obvious parallels to Heartbleed, the recent X server XkbSetGeometry info leak is probably a better example of a bug that rust would have prevented.
>For further reading, the JetLeak vuln in Jetty is practically identical to Heartbleed, except it occurred in Java, a nominally memory safe language.
>Tony took another look at Would Rust have prevented Heartbleed?. I think it’s a good post, summarizing the issue and clearly breaking down the difference between Heartbleed and “Tedbleed”. But again with the private key fixation. Worst case scenario for Tedbleed is “An attacker can recover arbitrary plaintexts from encrypted traffic”.
Nice attempt, NSA
>>
File: 1489174883827.gif (2MB, 218x240px) Image search: [Google]
1489174883827.gif
2MB, 218x240px
>>59374982
>Low-level is evil and exploitable, just use and trust this high-level standard library I made which is totally backdoor-proof
>>
>>59375117
Rust is open-source.
>>
what happened to the web dev thread?
>>
>>59375117
>high-level standard library
That exists in C as well, you drooling c tard
>>
>>59375103
>he ignores the part about shitty programmers being shitty programmers
>he ignores the part about how using rust actually makes this problem worse
Nice try CIA
>>
>>59375073
Who would have guessed that rust is a placebo...
>>
>>59375125
Open-source doesn't mean audited on a regular basis nor exploit-free.
>>
>>59375143
>the part about shitty programmers being shitty programmers
HA! Typical NSA tailored response:
So losing a chess game means "shitty player being shitty player" to you. That's laughable, NSA. No one is buying your shit
>>
>made hello world in rust
>4mb
Wew lad
>>
>>59375137
Pretty much why asm is the language of the future
>>
>>59375185
>make a hello world in c
>it's apparently insecure
Wew lad
>>
>>59375185
C does not have exception handling. It's meant for 80's computing and the projects that are written in C are unironically stuck in the 80's: like GTK+
Even after you have gone through the agony of using a language that is a disservice to the intelligent programmers (Linus doesn't count, he's on a different level and not everyone is Linus), you have to worry about memory safety.
C is not memory safe. As if the timesink development was not enough pain, you have to test your program for possible security vulnerability. When K&R came up with C, it was an ancient time. C's priority was being able to produce binaries that can run in an 800MHz processor with 64MiB RAM that can fit into floppies. Security was NOT a concern.
>>
>>59375175
You can check it yourself if you're that worried.
>>
>>59375195
>everything faster than Rust is insecure
Wew lad
>>
>>59375177
Absolutely, how the fuck is losing chess because you suck not your fault?
>>59375206
>using copypasta in an argument
CIA shills, when will they learn.
>>
>>59375043
Then you use a kernel written in C.

>>59375054
What if letting it continue to run would put your whole system at risk?

>>59375066
Normies like you aren't the ones CIA is using their hacking tools against.

>>59375137
Yeah except C actually lets you do useful stuff without it. How do you
#include <windows.h>"
in Rust?

>>59375177
>Haha you think the sky is blue? Well what if I said the same thing, but replaced the word sky with roast beef? Surely now you realize what an idiot you are, hahaha top kek
>>
>>59375228
>Chess player loses 1 game
>"Player is shitty"
NSA is trying really hard to defend exploit lang c
>>
>>59375072
It's only a problem when they start nesting and lisp sure does love nesting.
I'm probably just not used to functional yet, even the code in the first lecture takes a while to understand.
>>
File: one_punch_implying.jpg (31KB, 600x599px) Image search: [Google]
one_punch_implying.jpg
31KB, 600x599px
>>59374982

>can't into good development habits
>needs language babysitting to be productive
>>
>>59375247
>This level of damage control
>>
>>59375264
>can't into good development habits
Name a c developer who did
>>
>>59375248
You are shitty in that game yes
It's not rocket science, but knowing CIA niggers...
>>
>>59375295
>Chess player loses 1 game
>"Player is shitty"
NSA is trying really hard to defend exploit lang c
>>
>>59375029
>Say NO to the three letter agencies
This just in, CIA is now called CIAA
>>
>>59375206
>C does not have exception handling. It's meant for 80's computing and the projects that are written in C are unironically stuck in the 80's: like GTK+
Exceptions are LITERALLY just gotos. They're something that should remain in the 80's.

>you have to test your program for possible security vulnerability.
Or you could stop being a fizzbuzz kiddie and design programs in such a way that security vulnerabilities won't be a problem. The Rustics' attitude that "you don't need sound program design, the compiler ensures your program is safe" is the 21st century version of "you don't need lifeboats, the waterproof compartments ensure the ship won't sink".

>>59375215
If you can't be bothered to check through your C programs for vulnerabilities, why should we think you'd take the time to verify there aren't any backdoors in the Rust compiler?
>>
>>59375206
When the heck did programmers became such paranoid pussies with memory?
The resulting effect is the opposite: high memory usage traded for memory "safety". Memory usage is never safe, you're just too afraid to go low.

Also exceptions are not necessarily a good way to handle errors. Every try-catch block you write, god kills a kitten
>>
>>59375310
>he just repeats the same thing
Wow nice rebuttal, sure showed me.
>>
File: 1489268910463.jpg (475KB, 852x973px) Image search: [Google]
1489268910463.jpg
475KB, 852x973px
Oh you know, just the using the only language that is approved by my waifu
>>
>>59375327
>design programs in such a way that security vulnerabilities won't be a problem
That design does not exist. No big c project is free of security bugs
>>
>>59375270
>No argument so xe just starts calling everything xe doesn't like damage control

>>59375285
Linus

>>59375310
Is this a recorded message?
>>
>>59375327
I don't have crippling trust issues.
>>
>>59375285
John Carmack?
>>
>>59375339
>His exception system revolves around try - catch blocks
What's it like living in false security?
>>
>>59375352
>Linus
The most vulnerable kernel in 2017, good job
>>
>>59375339
If I use catch (Exception e) {} does he kill two kittens?
>>
>>59375350
And there are big Rust projects that are? ``Safe languages" don't mean vulnerabilities don't exist, they mean they're harder to find. And you know who's willing to take all the time they need to find vulnerabilities? It's certainly not the white hats.
>>
>>59375366
LOL
The biggest CIA nigger in this thread.
>>
>>59375359
>implying i use exceptions or try-catch
>>
File: 1489277333155.png (2MB, 1248x1920px) Image search: [Google]
1489277333155.png
2MB, 1248x1920px
I've just been making a website for my dads shitty company to make him happy today
>>
>>59375353
Then you shouldn't worry about security vulnerabilities.

>>59375366
Name one other usable kernel.
>>
>>59375378
>``Safe languages" don't mean vulnerabilities don't exist, they mean they're harder to find.
grep unsafe
>>
>>59375380
'c'ia would shill c because it makes their job easy
>>
>>59375372
he actually kills a kitten and a tiger. Dont do that
>>
>>59375389
How many buffer overflows does it have?
>>
>>59375390
NT

>>59375390
>you shouldn't worry about security vulnerabilities.
gee I wonder who sponsored that post
>>
>>59375393
>implying rust would fix any of the security issues that the CIA uses to exploit
Lad Wew
>>
>>59375390
While I trust most people to not be malicious, I don't trust most people to write good C code.
>>
>>59374982
>null termination is so hard goyim
>use our """"""""""safe"""""""""" language instead, goyim!
>we take care of it all for you, goyim!
>>
>>59375391
That assumes that there are no as-yet-undiscovered vulnerabilities in the compiler, and that source code is alwas available.
>>
>>59375412
It would, obviously. Rust even preven data races
>>
>>59375405
>NT
>Secure

>shilling NT
>kernel is written in C and C++

t. CIA nigger
>>
>>59375416
OH YES GOYIM YOU DON'T HAVE TO WORRY ABOUT MEMORY SAFETY, YOU ARE A TOP C HACKER MASTER, REMEMBER?
>>
>>59375405
If you're not willing to personally check the code of the compiler for backdoors, you have no justification in worrying about ``unsafe code".
>>
>>59375413
wouldn't that go for most mainstream languages?
>>
>>59375420
Same goes for C unless you're using CompCert.
>>
>>59375422
>yeah goyim rust even prevents data races
>use our language goyim
>we will even prevent data races
>>
File: 1476706949483.png (442KB, 1196x796px) Image search: [Google]
1476706949483.png
442KB, 1196x796px
>>59375390
>you shouldn't worry about security vulnerabilities.
I am not surprised since the CIA actually posts on /g/
>>
>>59375442
Most languages aren't as low level as C where you need to do manual memory management and unchecked operations all the time, where a single mistake in any of the code you write can be a vulnerability.
>>
>>59375436
>C programmers don't worry about memory safety
We worry enough to not trust another nigger shill trying to do our job for us and opening NSA backdoors in the process

Admit it, you only trust Rust's memory safety so you don't have to worry about memory at all. This is why we get ram-sucking abominations like "desktop" apps written in js and wrapped in minimalistic chrome engines nowadays
>>
>>59375460
That's what I have been telling you people. It took vault7 leaks for you people to realize it
>>
File: 1424594569573.jpg (428KB, 1920x1200px) Image search: [Google]
1424594569573.jpg
428KB, 1920x1200px
>>59375404
69
>>
>>59375470
In Rust you have to know what you're doing or you will never get a program to compile. The difference is the compiler can use the extra information you give it to do optimization, it's good documentation, and the compiler will tell you if you make a mistake.
>>
>>59375460
Why do you think the CIA even wants your data? Unless you're a threat to national security, you're beneath their concern. And if you ARE a threat to national security, using any processor from the last decade will make you insecure.
>>
>>59375491
>The difference is the compiler can use the extra information you give it to do optimization
Wow, it's like it's 1956 again.
>>
Now that the dust has settled, what's the best syntax?
Algol? (e.g. C, Java, Go)
ML? (e.g. OCaml, Haskell, ATS)
Lisp? (e.g. Common Lisp, Racket, Clojure)
>>
>>59375405
>NT
LOL

You mean the kernel that's exposed ring-0 escalation vulnerabilities though it's APIs? Fucking lol.
>>
>>59375502
Kek, this.
>>
everything is insecure who cares if someone reads your email you have nothing to worry if you don't have anything to hide
>>
>>59375493
>Why do you think the CIA even wants your data?
Uhm I'm not going to take any chances. I actually thought stallman was a meme but seeing the leak last week and how vigorously /g/ is actually defending C and possible 0days I am convinced that CIA is actually ITT RIGHT NOW.

I'm leaving /g/ as well. It was fun knowing you all.
>>
>>59375438

Fun fact: Intel compilers add dispatch stubs to everything they build - with the intention of selecting the "best" code for the architecture, of course. Never mind the little bit of extra crap that tries to phone home with performance metrics every so often.
>>
>>59375491
You seriously trust your compiler to basically write the code for you?
>>
>>59375504
First for C.

>tfw comfy C programming
>>
>>59375524
Fuck off NSA
>>
>>59375502
>>59375519
C is an outlier because instead of using types to guide optimization, it just makes a ton of shit undefined behaviour. Most languages just do less optimization.

Rust has types to prevent what would be undefined behaviour in C, so it can do all the same optimizations. And you get them automatically, no need to write restrict everywhere or memorize how C does memory barriers.
>>
>>59375544
That IS the job of the compiler, after all.
It's actually a lot easier to make a compiler do mundane things correctly than a human
>>
>>59375491
>yes goyim a machine can do your job better than you
>>
>>59375544
Where do you get that idea from?
>>
File: broken.png (102KB, 681x406px) Image search: [Google]
broken.png
102KB, 681x406px
I'm sick of this guys! I'm sick of you guys fighting over which language is the fastest or which language is the most retard proof. It is tearing us apart and destroying any discussion related to programming because
> lel your programming language sucks and because you don't use ...
This isn't Daily Programming Language Thread, this is the Daily Programming Thread, which means we talk about programming and not which programming language has the best benchmark results. The language shills are ruining these threads.
>>
>>59375561
Are you retarded?
>>
>>59375526
>defending c is a clear sign of cia shills
>defending a high-level language with potentially undiscovered backdoors is not
Oy vey.
>>
>>59375548
Rust also adds runtime checks to a lot of places where C normally doesn't give a shit and gives you undefined behavior.
Rust's type system is an improvement, but it's not magically the safest thing in the universe.
>>
>>59375561
Computers can do anything that is decidable far better than a human can, and that's all that Rust's static verification is.
>>
>>59375460
This
>>
>>59375548
>Rust is the first language to do any of this
Wow, baby duck
>>
Just wrote a program that uses the instantmusic package (song downloader built in python) to take a list of spotify song urls (say from your library) and downloads them to your local machine. Granted, its pulling from youtube so you may not get 320 kbs MP3s constantly if at all, but you at least get an easy way to start migrating from music services where they have you by the balls.
>>
>>59375555
Then lets just remove the human error out of the equation. Long live the machines era
>>
>>59375573
I agree.
It's always the rust shills that start this shit though.
We should just ban them.
>>59375577
>>59375590
>no you stupid goy how dare you question us trying to replace you with an inferior machine with backdoors
>>
>>59375599
>>59375561
Who let /pol/ in here?
These aren't even arguments this is some kind of concentrated shitposting
>>
>>59375588
Yeah, Rust isn't perfect.

>>59375593
The only languages that do ownership and borrowing like Rust are Rust itself and Cyclone, which also has garbage collection.
>>
>>59375587
Dear CIA, we know you think we are retarded but your shitty /b/ tier falseflagging is not saving you.

We know you post in /dpt/
We know you post in /ptg/
We know you post in /fglt/
We know you destroyed /fglt/
>>
>>59374952
>What are you working on, /g/?
I'm writing string functions in C for fun.
/* Concatenation */

#include <stdlib.h>
#include <stdarg.h>

char * concat(int x, ...)
{
va_list strings;
va_start(strings, x);

int total = 0;
char ** stringList = malloc(x * sizeof(char *));
for (int i = 0; i < x; i++) {
stringList[i] = va_arg(strings, char *);
for (int j = 0; stringList[i][j] != '\0'; j++)
total++;
}
char * z = malloc((total + 1) * sizeof(char));

int k = 0;
for (int i = 0; i < x; i++)
for (int j = 0; stringList[i][j] != '\0'; j++, k++)
z[k] = stringList[i][j];
z[k] = '\0';

va_end(strings);
free(stringList);
return z;
}


What do you think /g/? I'm pretty comfortable with programming, but I've only taken a couple of classes and started reading a few books, so I'm just working on stuff for fun to get more comfortable with it.
>>
>>59375504
Lisp.
>>
>>59375616
It's CIA trying to false-flag /pol/
>>
>>59375624
>stdarg.h
>char * concat
[triggered]
>>
>>59375616
>no no goy, it's not us

>implying i'm from pol
>>
>>59375624
That looks pretty good.
Recording var args into an array seems like a good place to use variable-length arrays, if your compiler supports it, instead of malloc().
>>
>>59375649
What?
>>
>>59375655
>Recording var args into an array seems like a good place to use variable-length arrays
Not him but isn't that exactly how they're passed to begin with (just after EBP instead of ESP)? What would be the point?
>>
>>59375624

The real challenge in using C, and becoming comfortable with it, is learning architecture - those concepts extend to any language, but are of critical importance with C in particular.

Pointers, for example, should rarely be made a part of a complex public-facing API. Understanding where an abstraction, such as an integer-based handle, is appropriate is the true challenge.

Things I had to learn to make C useful:
> Linked lists
> Hash tables - all kinds
> Red black tree

Then, as time moved on, linked data structures became less important as the focus shifted to data-oriented philosophy (everything is an array). This doesn't mean make an API all about arrays, it means a layer of abstraction is needed to make said arrays appear object oriented to a user, but the implementation as efficient as possible.
>>
>>59375624
What is this function trying to do?
>>
>>59375546
>>59375633
Okay I'm gonna need more opinions to get a consensus.
https://strawpoll.com/934dfyb

>>59375676
Yes, technically, on 32-bit x86 architecture under the standard C calling convention, but that's a lot of platform specifics to juggle, so it's usually better to just use the var args API
>>
>>59375704
Sorry. It takes any number of strings of any length and returns a pointer to a string with all given strings concatenated in the order they were given. The integer argument tells it how many strings there are to concatenate.
>>
>>59375738
>so it's usually better to just use the var args API
Yeah, but why would you just copy them onto the stack again instead of just using the API directly?
>>
>want to learn a new tool
>have to setup the environment
>lose all motivation
Anyone else or is it just me?
>>
>>59375773
You can't do that with the va_* functions that are part of the standard C library.
>>
>>59375750
Why not get any amount of strings until you reach a pointer to NULL?
>>
>>59375793
What tool are you talking about?
>>
File: anime_complain.gif (499KB, 500x514px) Image search: [Google]
anime_complain.gif
499KB, 500x514px
>>59374982
>>59375029
>>59375066
>>59375092
>>59375103
>>59375137
>>59375177
>>59375228
>>59375248
>>59375325
>>59375366
>>59375393
>>59375426
>>59375436
>>59375460
>>59375526
>>59375547
>>59375561
>>59375587
>>59375618

Daily reminder to report and ignore Rust shill spam. Do NOT respond to their bait posts.
>>
>>59375797
There's no reason that's better than just asking for the length.
In fact, it's easier to take the length because this way you can allocate space for the array of arguments beforehand, rather than having to scan the arguments twice.
>>
>>59375253
you learn to read the words only and by indentation (rather than focusing on the parens)

in fact the parens mostly disappear after a while, at least when you're not trying to pay attention to them
>>
>>59375822
Go back to >>>/a/
>>
>>59375773
I couldn't find a way to access whatever array or data structure they're packed into directly, and I need to access them twice; once to get the total number of characters to generate an array large enough for the new string, and a second time to copy each string over to the new string. Also the only stack storage used is a single pointer; I allocate all the string pointers on the heap, and free the memory at the end of the function.
>>
>>59375845
Anime website
>>
>>59375845
This is an anime website.
>>
>>59375797
That'd still require the user to include an additional argument which they'd have to explicitly declare. It would also mean I'd have to check each one to look for the end of the arguments.

Actually, I think it'd be impossible, because I need the number of strings to create an array for them, which I wouldn't have until I looped through them.
>>
File: 1438716669562.jpg (101KB, 750x980px) Image search: [Google]
1438716669562.jpg
101KB, 750x980px
>>59375845
lol make me nerd
>>
>>59375888
You actually could do it with a linked list but it's not worth it.
>>
Delphi = "life"
>>
Now that the dust has settled,
what's the final word on programming without I/O?
>>
>>59375916
There's no conceivable use for it.
>>
>>59375926
1. Fun
2. Testing overclocking stability / Hardware QA
>>
>>59375916
>>59375926
>>59375943
Shut the fuck up
>>
>>59375910
Delphi is one of the deadest languages I can think of.
It's even more dead that D.
>>
>>59375962
>that
than*
>>
>>59374973
Pascal still rapes your anus.
>>
>>59375943
>2. Testing overclocking stability / Hardware QA
You can't get any information on ``stability" without some kind of I/O. Not to mention that any conforming compiler is likely to optimize away any non-I/O code.
>>
>>59375943
>2. Testing overclocking stability / Hardware QA
Hardware crashing or not is a form of output. (Binary 1 and 0)
>>
>>59375971
Pascal only has use for CC noobs on algorithms classes
>>
>>59375910
Sucked to death by greedy jews. Thankfully there is alternatives.
>>
>>59375908
That is true. But yeah it wouldn't be worth it, as there wouldn't be a usability enhancement.
>>
>>59375750
ah? you mean something like this?
import std.stdio;

void main(string[] args){
string result;
foreach(i; args[1 .. $]){
result~=i;
}
writeln(&result);
}
>>
>>59375975
SuperPI, a tool very commonly used to test CPU stability, barely outputs anything. The output is unrelated to its function.
>confirming compiler
Confirming to what?
Write a Pi calculator in C with no input or output and compile it. No major C compiler will turn it into int main() { return 0; }
Anyway, you should have your own compiler for your own non-I/O language.
>>
>>59375999
D had so much potential. I really liked D.
**Showoff.**
>>
>>59375983
Nah. Although its footprint in the industry is small, it is still used today from small stuff to big ones.
>>
>>59376002
>SuperPI, a tool very commonly used to test CPU stability, barely outputs anything. The output is unrelated to its function.
So then how do you determine CPU stability from running this program?

>Confirming to what?
The language specification.

>Write a Pi calculator in C with no input or output and compile it. No major C compiler will turn it into int main() { return 0; }
This site
https://crypto.stanford.edu/pbc/notes/pi/code.html
has a C program that will approximate the first 800 digits of pi. If you comment out the printf, GCC with ANY optimization setting will generate only two assembly instructions.
>>
>>59376042
>>
I find it hard to believe you have to write all that nonsense for such trivial tasks though. Pretty sure D can solve this with less LoC than that too
>>
File: windows.jpg (24KB, 505x405px) Image search: [Google]
windows.jpg
24KB, 505x405px
windows y you do dis
>>
>>59376069
Where there's not really a point in writing a function for concatenation in a language with a concatenation operator.
>>
>>59376067
>GCC with ANY optimization setting will generate only two assembly instructions.
But that is retarded in many ways...

Or did I get baited?
>>
>>59375493
CIA wants a database. They want a database of everyone's info so when the time comes where they have a strong enough AI to parse through it, the AI can use it.
>>
>In 2nd semester java class at uni
>everything going okay
>new assignment to write some methods from the java String Api

Why is this autistic shit an assignment? I'm not creating any functionality, just copying someone else's work...
>>
>>59376201
Because your university is a piece of shit.
>>
>>59376201
>complaining because he doesn't understand the assignment
>>
>>59376214
I understand what they want us to do and can kinda understand why they want us to do it... It's just silly to me when I can literally open up the source code and obfuscate it a little bit then turn that in as my work...
>>
>>59376201
>I'm not creating any functionality, just copying someone else's work
Good. They are training you already
>>
File: ck2.png (205KB, 3072x2048px) Image search: [Google]
ck2.png
205KB, 3072x2048px
just fuck my shit up
https://www.youtube.com/watch?v=P8cZRZhRj-s
>>
>>59375639
Sure looks like it. At first I thought it was ex CTR employees hired by Mozilla to shill for Rust. The intensity of these forced meme is too high for that I think. They're even faking opposing posts from the same copypasta so that it will lead right in to their next talking point. I'm thinking only a government agency of some kind could be so incompetent as to try to sell a programming language on the consumerism board of a Taiwanese kayaking enthusiast forum with a negligible amount of people who can even fizz buzz.
>>
>>59376245
kek
>>
>>59376201
Sounds like the idea is to help you understand how it works. Basic string shit should be in semester 1 though.
>>
>>59376156
No, it's not retarded. The "as-if" rule means that none of the operations have any meaningful effect without I/O, so they can be safely eliminated.
>>
>>59376254
everyone ignore this post please
>>
>unix:!macx: LIBS += -lmpv
>win32: LIBS += -L$$PWD/libs -lmpv
>macx: LIBS += -L$$PWD/../../../../usr/local/Cellar/mpv/0.17.0/lib -lmpv

what did macos mean by this
>>
>>59376264
Yeah, its trying to get us to think how this shit is set up but its just so damn boring.

Also, a friend from class is super fucking stuck trying to figure out where to start. He doesn't even know how to read the API to see return methods............
>>
File: 2vht5xw.jpg (37KB, 638x357px) Image search: [Google]
2vht5xw.jpg
37KB, 638x357px
>>59375822
Ignored it! Clocking out now
>>
https://www.youtube.com/watch?v=z43bmaMwagI

Thoughts?
>>
>>59375624
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdint.h>
#include <string.h>

char *concat(size_t n, ...)
{
va_list args;
va_start(args, n);

// Find total length of output string

size_t len = 0;
va_list iter;
va_copy(iter, args);

for (size_t i = 0; i < n; ++i) {
const char *str = va_arg(iter, const char *);
size_t n = strlen(str);

// Overflow. Only sensible option is to fail.
if (len >= SIZE_MAX - n)
return NULL;

len += n;
}

va_end(iter);

// Null terminator
++len;

char *res = malloc(len);
if (!res)
return NULL;

char *ptr = res;
for (size_t i = 0; i < n; ++i) {
const char *str = va_arg(args, const char *);

// Using the non-standard (but POSIX standard) stpcpy,
// so we aren't constantly rescanning over the string
ptr = stpcpy(ptr, str);
}

va_end(args);
return res;
}

int main()
{
char *ptr = concat(4, "Hel", "lo, ", "Wor", "ld!");

printf("%s\n", ptr);

free(ptr);
}
>>
>>59376297
You think that's bad? Just remember the guys that didn't make it to the 2nd semester. My course had a guy that couldn't understand printf even after being baby stepped through it, he didn't understand %f/%s/etc.
>>
>>59376292
it means macos is absolute garbage and an affront to the legacy of UNIX.
>>
>>59376321
How could you possibly overflow a size_t? Wouldn't that mean you have more bytes in your strings than you have possible addresses?
>>
>>59376201
>2nd semester java class
wait what? your university has multiple semesters dedicated to learning a programming language?

at my university, we had one class dedicated to learning a language (either python or java depending on the professor), and everything else was algorithms, data structures, networking, machine learning, system architecture, and math.

do they at least teach you some java EE servlet development and stuff? i don't understand how you can possibly stretch a basic java class over two entire semesters
>>
>>59376367
Yes, it would be stupidly unlikely to be able to overflow a size_t, but I threw it in there for correctness' sake.
>>
>>59376377
Probably meant, 2nd semster, Java class.
>>
>>59376377
simple

Java 1 you learn fundamentals

Java 2 you learn all about OOP inherit, Poly, Exceptions, GUIS

Java 3 (the hardest) you learn all about java EE networking, servlets, databases,sql
>>
>>59376321
Thinking about that again, I probably should have added an explicit check for n == 0, so we don't get any malloc(0) shenanigans.
It doesn't make the function incorrect, but just rely on implementation defined behaviour.
>>
>>59376377
>not having algorithms/data structures/networking/etc all based on the language
>>
>>59376469
It is about the concept doesn't matter about the language. The language is just the tool. If you have the right idea, it is easy to use whatever tool. I learnt Machine Learning in Matlab and I can easily translate that knowledge into another language.
>>
>>59376367
>>59376390
Actually, I just thought of a way it could be overflowed without requiring more than SIZE_MAX memory:
char *str1 = /* some SIZE_MAX/2 string */;
char *str2 = concat(3, str1, str1 + 1, str1 + 2);
>>
>>59376334
haha now that you mention it, he uses println for every single damn print statement

>>59376377 what >>59376408 said without java 3, after that I think we go to c
>>
>>59376408
I see, that's interesting

>>59376469
My professors let the students choose any popular language for almost every project.
>>
>>59376483
The concept is irrelevant if you can't apply it.
Practical > Theory.
>>
>>59376505
You must be one of those people who try to solve the halting problem and inevitably fail.
>>
File: 1478163441503.png (418KB, 600x802px) Image search: [Google]
1478163441503.png
418KB, 600x802px
Should I make fizzbuzz a standard library function in my language?
>>
File: pinball illusions.png (17KB, 275x117px) Image search: [Google]
pinball illusions.png
17KB, 275x117px
I'm trying to come up with shitty game ideas. Please, throw them at me.
>>
>>59376537
no
>>
>>59376505
Concept is the key to applying it correctly. If you don't have sound theory, you are just another codemonkey cobbling code together that you don't understand.

Learning how biases propagate, different theories behind machine learning and NN as well as the maths behind it > Putting together code from someone's else library about machine learning.
>>
>>59376545
Why not?
>>
>>59376500
yeah after Java 3 we learn C you are correct

>>59376501
it is a very interesting way to structure an OOP programming language I thought it was very clever since java especially has so much to cover
>>
>>59376537
Only if there is no I/O.
>>
>>59376505
That's retarded. Most concepts were """"irrelevant"""" first, until an application was found.
>>
>>59376560
Fizzbuzz is just a template for demonstrating how to use a language, the only thing anyone would use it for is demonstrating you have programming skills

Honestly I don't understand how someone designing a language would need to ask about this concept
>>
>>59376569
>it is a very interesting way to structure an OOP programming language I thought it was very clever since java especially has so much to cover

I know some people that think OOP is pointless because we learned linear first and I guess they don't see the benefits of breaking your code into smaller pieces
>>
>>59376586
FizzBuzz is a demonstrating that you have programming thinking because you are supposed to work through the conditions given backwards when most people would work through the conditions in the steps that are given. It is the equivalent of babby first programming trick question.
>>
>>59376582
Why would that change the answer? The function can just return strings.
>>59376586
Fizzbuzz is a definition of a program. A spec of sorts. Of course I won't put in the spec itself, just my implementation of it.
>>
>>59376600
OOP is good for working in large teams in the real world every software firm always ask about and talk about OOP

It also helps breaking down large problems into smaller ones it is a good technique for problem solving large applications
>>
>>59376600
>OOP is the only way to divide and conquer
Jesus.
>>
Should I read this book?

https://www.degruyter.com/view/product/175909

I want to read it out of fascination for what it's about. I've digged around on the internet and I've gotten nowhere. Apparently it's about computers.
>>
>>59376619
>in the real world
How do you determine if a world is real? Am I in a real world right now?
>>
HELLO ALL,

I know this likely is not kosher, (don't visit this board, truthfully) but can anyone assist me this issue I am having in C?

Working on coding Conway's game of life, and everything APPEARS to be in order, but when checking a cell for live neighbors it sometimes adds neighbors where there should be none or fails to detect them when they exist.

Can post code if anyone is willing to help
>>
>>59376533
That makes no sense, the fact I think practical > theory means I want to try my hand at a problem that hasn't been solved in 80 years (for good reason)?
You sound like the kind of faggot to ask potential employees to solve problems in 10 mins that took the best minds in the industry decades to solve.
>>
Optimization levels
>Level one NEET
void strcpy(char a[], char b[]){
int i;

for(i = 0; a[i] != '\0'; ++i)
b[i] = a[i];

b[i] = '\0';
}

>Level 2 Indian

void strcpy(char a[], char b[]){
int i;
i = 0;
while( (a[i] = b[i] ) != '\0')
++i;
}


>Level 3 /g

void strcpy(char a[] , char b[])}
int i;
for(i = 0; (a[i++] = b[i++]) != '\0';)
;
}



>Level 4 John Carmack

void strcpy(char* a, char *b){
while( (*a = *b) != '\0'){
a++;
b++;
}
}



>Level 5 Linus

void strcpy(char * a, char* b){
while( (*a++ = *b++) != '\0')
;
}


>Level 6 One true Stallman
void strcpy(char *a, char* b){
while( *a++ = *b++)
;
}


>What level are you ?
>>
File: 1483447574449.png (67KB, 869x725px) Image search: [Google]
1483447574449.png
67KB, 869x725px
>>59376632
Just post the code.
>>
>>59376632
>Can post code if anyone is willing to help
I would. If you didn't post this retarded sentence and just posted the code instead.
Also your reddit spacing doesn't really make it any better.
>>
>>59376627
Even if you're in a simulation, the simulation is still running on a computer that's present in the "real world", so by extension, the structs in that computer's memory that represent "you" are part of the real world as well.
>>
>>59376619
Oh, don't get me wrong, I like OOP my friends just are having a huge problem understanding why we use OOP

>>59376622
>Not what I meant
>>
>>59376632
Are you changing values in the 2d array (or whatever data structure you're using) while also reading from it?

If so, remember: the game of life rules specify the NEXT state, and don't modify the CURRENT state in any way.
>>
>>59376669
>I like OOP
>>>/r/ibbit
>>
>>59376655
>implying "while(*a++ = *b++)" is obscure
I'm pretty sure that appeared in K&R.
>>
>>59376669
OOP is good for certain situations people here at /dpt/ just hate it for no real reasons at all
>>
>>59376613
>Fizzbuzz is a definition of a program. A spec of sorts. Of course I won't put in the spec itself, just my implementation of it.
Yeah but the only purpose that serves is giving people that wouldn't know how to answer an interview question a way to just import it

Fizzbuzz in itself is highly contrived and doesn't do anything. It represents the way a lot of programs work but there's no reason anyone would want to have a fizzbuzz module
>>
>>59376669
Who are you quoting, redditor?
>>
>>59376688
Such as?
>>
>>59376655
Python

a = b
>>
>>59376694
Making any given program complete shit.
>>
>>59376688
>no real reasons
There are plenty of valid reasons to hate OOP.
>Encourages shared mutable state
>Makes everything in general stateful
>Kingdom of nouns
>Doesn't model any problem well
>>
>>59376656
Love you anon. Looks like I'll need to post in two parts.
int checkneighbors(char board[40][40], int row, int col)
{
int neighbors = 0;
if (row == 0 && col == 0)
{
if (board[row + 1][col] == '*')
neighbors = neighbors + 1;
if (board[row][col + 1] == '*')
neighbors = neighbors + 1;
if (board[row + 1][col + 1] == '*')
neighbors = neighbors + 1;
}
else if (row == 0)
{
if (board[row + 1][col] == '*')
neighbors = neighbors + 1;
if (board[row][col + 1] == '*')
neighbors = neighbors + 1;
if (board[row + 1][col + 1] == '*')
neighbors = neighbors + 1;
if (board[row][col - 1] == '*')
neighbors = neighbors + 1;
if (board[row + 1][col - 1] == '*')
neighbors = neighbors + 1;
}
else if (col == 0)
{
if (board[row + 1][col] == '*')
neighbors = neighbors + 1;
if (board[row][col + 1] == '*')
neighbors = neighbors + 1;
if (board[row + 1][col + 1] == '*')
neighbors = neighbors + 1;
if (board[row - 1][col] == '*')
neighbors = neighbors + 1;
if (board[row + 1][col - 1] == '*')
neighbors = neighbors + 1;

}

>>59376659
tfw you have a job and are used to writing professionally
>>
>>59376678
can you objectively tell me what is wrong with OOP
>>
>>59376702
Are those inherent problems with OOP or just Java?

Java is crap
>>
>>59376700
shallow copy
>>
>>59376705
part two
else
{
if (board[row - 1][col] == '*')
neighbors = neighbors + 1;
if (board[row][col - 1] == '*')
neighbors = neighbors + 1;
if (board[row - 1][col - 1] == '*')
neighbors = neighbors + 1;
if (board[row + 1][col] == '*')
neighbors = neighbors + 1;
if (board[row][col + 1] == '*')
neighbors = neighbors + 1;
if (board[row + 1][col + 1] == '*')
neighbors = neighbors + 1;
if (board[row - 1][col + 1] == '*')
neighbors = neighbors + 1;
if (board[row + 1][col - 1] == '*')
neighbors = neighbors + 1;
}
return neighbors;
}

void nextgen(char board[40][40], char board2[40][40])
{
int rowcount = 0;
int colcount = 0;
int neighborcount = 0;
for (rowcount = 0; rowcount < 40; rowcount++)
{
for (colcount = 0; colcount < 40; colcount++)
{
neighborcount = checkneighbors(board, rowcount, colcount);
if (board[rowcount][colcount] == ' ')
{
if (neighborcount == 3)
board2[rowcount][colcount] = '*';
}
else
{
if (neighborcount < 3)
board2[rowcount][colcount] = ' ';
else if (neighborcount > 3)
board2[rowcount][colcount] = ' ';

}
}

}

}

these two functions are likely where the problem lies, but I will also post main just to be sure. Please excuse my shit code as I am a novice
>>
>>59376710
OOP
>>
>>59376646
Practicality and theory go hand in hand. One is not better than the other. The programmer should be guided by careful theoretical study, not hammering out inefficient solutions left and right in the name of hastily getting things done.
>>
>>59376700
enjoy your shit
>>
>>59376719
>functions
Procedures.
>>
>>59376719
int main()
{
int gencounter = 1;
int row = 0;
int col = 0;
char board[40][40];
char board2[40][40];
for (row = 0; row < 40; row++)
{
for (col = 0; col < 40; col++)
{
board2[row][col] = ' ';
}
}
readfileintoboard(board);
row = 0;
col = 0;
while (1)
{
printf("Behold, life itself! This is generation %d.\n", gencounter);
puts("Remember: press Enter to move to the next generation and Q to quit.");
for (row = 0; row < 40; row++)
{
for (col = 0; col < 40; col++)
{

printf("%c", board[row][col]);
}
printf("\n");
}
nextgen(board, board2);
genchange(board, board2);
getchar();
gencounter++;
system("cls");
}
}

I have spent a while trying to find out why this does not work but I am at a loss.
>>
>>59376711
a = b[:]
>>
>>59376702
OOP models specific problems very well you can just google all of them
>>
>>59376711
Lmao. It isn't even any copy. Because python treats everything as an object when you do a=b, you are basically assigning the object referenced by a to another label called b. Nothing is copied at all.
>>
>>59375206
exceptions are horrid. C style bools or ints for return statuses are way better. I say this as someone who writes C++ & JS for a job, and Go at home.
>>
>>59376740
Isn't that a shallow copy?
>>
>>59376746
Zero overhead nigger
>>
>>59376655

>int
Incorrect behavior on 64-bit operating systems for strings whose size is larger than 2 GiB.
>>
>>59376705
>>59376719
>>59376734
I haven't read too far into your code, but you haven't covered the row == 39 or col == 39 cases.
Also, your code is stupidly repetitive. You should try to remove a lot of the duplication.
>>
>>59376766
are you supposed to use size_t ?
>>
>>59376734

>system("cls");
RRREEEEEEEEEEEEEEEEEEEEEEEEEee
>>
>>59376778
oh, you're right, good point. I am aware of redundancies and I will go back an optimize it, just working on functionality first. Thank you
>>
>>59376655
I think both Carmack and Linus would remove the != '\0' check.
>>
>>59376721
y tho

Isn't Python object oriented? Because you just call functions on top of functions

pygame.transform.scale(pygame.image.load('snek.png'), (120, 20))


I absolutely despite Java and how verbose it is but it makes sense to me
>>
>>59376807
Yes, and it has all those problems.
>>
>>59376794

Yes. If signed behavior is desired, ptrdiff_t is the correct choice.
>>
>>59376655
(setf a b)
>>
>>59376794
Yes
>>
>>59376550
>Concept is the key to applying it correctly.
That would be experience, with experience you understand the major problems and can avoid/solve them early (not to mention quicker).
Don't get me wrong, theory is important, it's just experience + theory is more important than pure theory, you need experience to truly understand it.
Someone that sits down and makes projects is going to do a lot better than someone who sits down and writes essays on theory about said projects.
>>
>>59376669
It makes modeling some things convenient. It's extremely overused, though.
>>
https://www.youtube.com/watch?v=MaA0vFKt-ew

>can't afford a computer for a computer science class
>>
I need help understanding C++. I'm going through the C++ for Everyone and I got to Chapter 5 Functions, and I don't know where to go from here:

#include <iostream>
#include <cmath>

using namespace std;

int getValue();

void squareValue();

int main()
{
int num;
num = getValue();
cout << "The value entered is " << num << endl;
squareValue();

return 0;

}

int getValue()
{
int val;
cout << "Enter a number " << endl;
cin >> val;
return val;

}

void squareValue()
{
int val = getValue();
cout << "The value squared is " << val * val << endl;
return ;

}

I would like to make it so that the void just takes the getValue and squares it without needing to enter the same number again.
>>
>>59376700
Actually, since strings are objects in Python, that would just create a second pointer to the original string, not copy it. You'd have to iterate over the string in Python, too.

Nice try though, pajeet.
>>
>>59376750
>Shallow copies duplicate as little as possible. A shallow copy of a collection is a copy of the collection structure, not the elements. With a shallow copy, two collections now share the individual elements.

Copy implying something is duplicated. Nothing is duplicate when you type a = b in python.
>>
>>59376914
>without needing to enter the same number again
pass an argument?
>>
>>59376544
Something I've been thinking about for a while, but been too lazy/retarded to implement, is a space warfare/colonization game in a "hard sci-fi" universe, where spaceships can travel at nearly the speed of light (using Bussard ramscoops perhaps), and communication is limited to the speed of light as well. It would be turn based, with each turn being maybe one game year. Reporting of anything that happens in-game would be delayed according to the light speed lag to the player. For example, if a fleet orbiting the player's world is sent to another planet that's 4 light years away, if the fleet departs in year X, it won't reach it's destination until year X + 4, and the player's world won't hear about it until year X + 8. If they then decide to give the fleet further orders, say to come back home, they won't be recieved until year X + 12, and the people back home won't even know if the orders were recieved correctly until year X + 16.

The player can move around between worlds by getting on a ship and traveling, and this affects what options they have in game. For example, if you're on the homeworld, you have a lot of control over what ships to build, but relatively little about how ships conduct themselves in battle. On the other hand, if you board a flagship to lead a fleet, you have lots of control over the ships in that fleet, but it will take years to find out what's going on back home, never mind have a say about it.

I'm mainly interested in seeing what strategies would work in a war under these conditions, as not only are the fighting forces not able to communicate with the HQ, the commanders won't even know the results of battle (or even that a battle happened) until years later. You could very easily end up giving messages over radio to a fleet that was destroyed years ago, and you wouldn't know about it until the enemy shows up on your doorstep to tell you about it.
>>
>>59376807
Python definitely has nicer OOP than Java, but it still has all of OOP's inherent flaws.
>>
>>59376939
Yeah, I think so.
>>
>>59376584
I said if you can't apply it, not they're totally irrelevant.
Great, you know the concept of a bubble sort, know how to implement it in code? If not then what good does that do you?
>>
>>59376544

a dating sim but all the girls are actually traps

the player can go through minigames to get "points", and spend "points" in the store to buy accessories for their trap date, like cute underwear and buttplugs
>>
>>59376880
Sure. You get that experience in the working world like most people do.

>Someone that sits down and makes projects is going to do a lot better than someone who sits down and writes essays on theory about said projects.
It is clear you never been to any college level classes if you think because a module is theory heavy that means you write essay all day long and don't practice it. It just means the focus isn't as much on practical. Take my ML and matlab for example. I am still tasked to create a fuzzy NN for house house appliances. It is just that the professors understand the importance on theory because when I go to the working work the company might no be using the language taught in my classes and to adapt to their new language you need a strong theory base.
>>
>>59376705
>neighbors = neighbors + 1;

You could probably change that to neighbors++ or neighbors += 1.
>>
>>59376655
Isn't level 6 risky?
It can crash
>>
>>59376970
So according to your retardation some new concept which nobody knows how to apply yet is "irrelevant"?
>>
>>59376982
Of course the redditor is a literal fag.
Piss off.
>>
>>59376970
If you know the theory and can't implement it in code, then you have failed your module.
>>
>>59377021
*teleports behind you*
*pulls down ur pants*
*licks your boihole*
*runs away*
>>
>>59377011
Not if the strings are null terminated, and if they aren't you're fucked anyways.
>>
fuck I'm bad at computer

how the fuck do I bubble sort a two-dimensional array in C++
>>
>>59376983
>You get that experience in the working world like most people do.
You should have that a lot of the experience before working.

>if you think because a module is theory heavy that means you write essay all day long and don't practice it.
It was just an example, no need to get spastic.

>the company might no be using the language taught in my classes and to adapt to their new language you need a strong theory base
Experience isn't necessarily language specific, actually going through the process of creating it and encountering problems that you're likely to encounter is a much better learning experience than just reading up on theory imo. And hey, if they use the same language that's great too.
>>
>>59376655
void
strcpy(char *a, const char *b)
{
size_t len;
size_t len_safe;
const char *b_copy;

len = strlen(b);
b_copy = b;
assert(b_copy == b);
while (*b)
{
len_safe++;
b++;
}
assert(len_safe == len);

b = b_copy;
assert(b == b_copy);
*a = *b;
assert(*a == *b);
if (*b)
strcpy(++a, ++b);
}
>>
>>59377161
How do you want to sort it? Do you want each column sorted in isolation from the rest of the array? Do you want each row? Do you want the whole thing left to right, top to bottom? top to bottom, left to right? something else? These are questions you need to ask yourself. After you answer them writing the algorithm is easy.
>>
>>59376880
this

I only really understood programming after programming multiple projects
>>
>>59377193
Huge waste of space for literally no benefit.
>>
>>59377019
Well yeah, what's the point of the new concept?
What's the point of knowing how to run with three legs when we have two?
>>
>>59377172
>actually going through the process of creating it and encountering problems that you're likely to encounter is a much better learning experience than just reading up on theory imo

Lmao every problem you encounter that way is due to language restriction, tools restriction or library limitation. Any actual theory problem will be encounter when you are made to put theory into practice. You are a moron if you think classes don't have practical portions as well.

>You should have that a lot of the experience before working.
None which are tied to your module. You get those experience from internship, final year projects, modules that are project/practical based. You shouldn't go into a Machine Learning class expecting it to be practical based.

>It was just an example, no need to get spastic.
>Lmao watch me strawman your argument by saying theory heavy class = writing essay all day long and don't practice it
>Gets called out
>It was just an example, no need to get spastic.
End yourself retard.

Fuck off you uneducated pleb. All good college courses have a healthy mix of theory and practical modules. Expecting all classes to be practical heavy is just making an army of pajeets, something this world doesn't need.
>>
>>59377193
wat r u dng
>>
>>59377221
Bachelors are a foundation for Masters and Masters are a foundation for PhD where people do in fact come up with ways to run with three legs. You are a moron if you think teaching concepts isn't important.
>>
>>59377230
>he fell for the computer science university degree meme
>>
>>59377242
Those people actually create the three legs though. Besides, the people actually coming up with unusable concepts are at the forefront of their fields, aka they aren't you, me or anyone on this board. They're simply edge cases.
>>
>>59377244
Here it comes. The sour grapes.
FYI you won't be coding in whatever language you are coding in if the person didn't go to college.
>>
>>59377265
The thing is that they all started by getting their bachelors degree first you moron. A bachelors degree isn't the "end" of education. It is and should be a stepping stone to the next level and hence important to introduce basic concepts.
>>
>>59377201
it's a 2d integer array, and I'm just trying to sort it in descending order on one column, arr[][7]

I pass in a two-dimensional array into a function that looks like this:
void bubbleSort(int arr[][8], int size)
{
for (int i = 0; i < size; i++)
for (int j = 0; j < (size - i - 1); j++)
if (arr[j][7] > arr[j + 1][7])
{
for (int k = 0 ; k <= 7 ; k++)
swap(arr[j][k], arr[j + 1][k]);
}
}


the fact that I'm three for-loops deep tells me I have to be doing something wrong
>>
>>59377271
not true
>>
Currently working on Project Euler (about a third of the way through level 2!)

What am I doing wrong (besides using C++)?

I'm using the GMP to get really large numbers, but when I use the "set_str" initialization function, XCode freaks out because apparently I'm not calling it correctly (even though I'm passing the arguments in the correct order).

Thoughts?
>>
>>59377303
Tell me what meme language you code in senpai
>>
>>59377310
>XCode
>>
>>59377333
Java
>>
>>59377360
> Java was originally developed by James Gosling at Sun Microsystems (which has since been acquired by Oracle Corporation)
>James Gosling received a Bachelor of Science from the University of Calgary [5] and his M.A. and Ph.D. from Carnegie Mellon University.[2][6][7]

?
>>
>>59377230
>Lmao every problem you encounter that way is due to language restriction, tools restriction or library limitation.
Or because you don't understand it as well as you think you do. But aside from that, isn't knowing the restrictions of your tools important?
>Any actual theory problem will be encounter when you are made to put theory into practice.
Is that a "I'll find that problem when it's too late" or with the following sentence?
>You are a moron if you think classes don't have practical portions as well.
Don't know where you went to uni but with the amount you're jerking off to theory, it can't have been very much. Besides, "has practical" isn't good enough it should have a shitload of practical. You should be getting projects out the ass as assignments.

>You get those experience from internship, final year projects
I've always hated the idea of internships for programming, you either know how to do the work or you don't (specialized fields excluded). With final year projects they're definitely good but I wouldn't say it's enough, depends on the project though I suppose.

>mention something theory entails (essays, plenty of essays in theory)
>s-strawman!!
You first.
>>
>>59376939
I've been trying to pass the argument but have been getting nothing but errors in Visual Studio; I'm just not getting it. Can you throw me a bone?
>>
>>59377298
If you're just doing it on one column that k shit shouldn't happen, so rip out that third for loop and change k to 7. Also you can add a boolean in the if block and test for it in the outer for loop, and your algorithm will stop early if the list is already sorted.
void bubbleSort(int arr[][8], int size)
{
bool sorted = False;

for (int i = 0; i < size && !sorted; i++)
for (int j = 0; j < (size - i - 1); j++)
if (arr[j][7] > arr[j + 1][7])
swap(arr[j][7], arr[j + 1][7]);
else
sorted = True;
}
>>
>>59377265
>aka they aren't you, me or anyone on this board
Speak for yourself.
>>
>>59377284
Yeah and those concepts are actually applicable, you don't invent a new concept we can't use with a bachelors or even masters degree, you learn about what has been done and what you can use.
>>
>>59377271
Oh, are you going to write the next C?
When are we getting it?
>>
>>59377538
I'm going to write the next Java
>>
>>59376914
Don't program anymore, you're just wasting your time. It's good that you are trying to learn and stuff but C++ isn't for everyone and your code shows.
>>
i might do some ml stuff but there's no way i can be assed to classify all the data i need to

choices choices
>>
>>59377463
>mention something theory entails (essays, plenty of essays in theory)

You are a first class moron. Physics has a lot of theoretical lessons. Go ask any college study if they have written a lot of essays for their classes or not. Theory isn't writing essays. Theory is teaching you the concept, ideas and maths behind a subject. Explain to you how Pythagoras theorem works is theory. Did your high school teacher ask you to write an essay on it?

>isn't knowing the restrictions of your tools important?
Yeah. But the important thing is knowing which tool to use in the first place. Different tools have different restrictions. Imagine the horror when you suddenly have to use another different language in the working world. Oh now you are on the same footing as the dude who knows more theory except he has a head start.

>You should be getting projects out the ass as assignments.
You get projects in modules which are project based. Or do you not read module descriptions before signing up for them? Oh yeah you haven't been to college so it is clear you have no idea how colleges work. Here is a basic guide. There are modules heavy in theory and there are modules heavy in project work. You are required to take a minimum amount of both.

>I've always hated the idea of internships for programming, you either know how to do the work or you don't (specialized fields excluded).
Internships gives you infinitely more real world working experience then fucking projects will ever.
>>
>>59377469
What are the errors?
>>
>>59377573
C#++
>>
how come you don't see any mexican programmers?
>>
>>59376914
Consider suicide.
>>
>>59377598
because they don't teach algebra at MIT
>>
>>59377538
Awww isn't it sweet how mad you are that you didn't get a chance to go to college.
>>
>>59377598
https://www.youtube.com/watch?v=XKu_SEDAykw
>>
>>59377598
Because they refuse to learn English, and programming is perhaps the last place non-English speakers aren't tolerated.
>>
>>59377573
Call it something comfy like Coco
>>
>>59377615

i tihnk thats literally the only one ive seen
>>
>>59377635
Why not just call it Comfy Lang?
>>
>>59377310
Sovled it...
Needed to add ".c_str()" to the string. Fucking kill me
>>
>>59377617
what about all the russian programmers who code in russian

or all the chinese programmers who code in chinese
>>
>>59377655
New thread:

>>59377700
>>
Why are Chinese and Russians the best programmers?
>>
>>59377670
In English. The point is that they learn basic english to code. Mexicans hate english.
>>
>>59377670
Irrelevant to civilized society.
>>
>>59377691
hard times create hard working people
>>
>>59377702
>literally the two most powerful countries in the world, who have been double tag team dry dog fucking the U.S. from both ends for the past 25 years
>irrelevant

>>59377701
>implying Russians don't program in Russian
>implying Chinese don't program in Chinese

Nice samefag MI6 shill, Muhammad. Fuck right off with this Islamo-centric Sharia degenerate bullshit.
>>
>>59377727
>implying Russians don't program in Russian
>implying Chinese don't program in Chinese
Please tell me what coding language they use
>>
>>59377478
Fuck. I must be doing something really wrong here. I feel like a big dumb cuck.

I'm trying to swap whole rows of the 2d array and have them in descending order by the value in [][7].

Don't I need a loop or some kind of memcpy algorithm to swap whole rows?
>>
New thread:
>>59377805
>>59377805
>>59377805
>>
>>59377591
>You are a first class moron. Physics has a lot of theoretical lessons. Go ask any college study if they have written a lot of essays for their classes or not
I told you to not be a spastic m8. Plenty of X in Y != Most of Y is X.

>Oh now you are on the same footing as the dude who knows more theory except he has a head start.
Not really, shit passes over between languages quite well most of the time. As extremely basic examples: syntax errors are always going to exist, there's probably going to be errors with null objects in OOP languages, you're going to have to link libraries, etc.

>You get projects in modules which are project based.
What part of "out the ass" don't you understand? The vast majority of modules should include decent-sized projects. Again, there's no point to the theory if you can't put it to practical use and if they're not seeing if you can put it to practical use then they aren't doing their job are they.

>Oh yeah you haven't been to college so it is clear you have no idea how colleges work.
Got an armchair psychiatrist have we? Tell me about my daddy issues next.

>Internships gives you infinitely more real world working experience then fucking projects will ever.
In software they're usually just a way to pay some scrub pennies to do grunt work (if at all, I hear Americans don't get paid for interning). Again, specialized fields are exceptions.
>>
>>59377612
Nice deflection.
>you fell for the CS uni meme
>>[language] wouldn't exist without CS at uni
>where's your language then?
>>y-you're just mad you didn't go!
Also, I did. Not the first guy though.
>>
>>59377652
CLang for short.
>>
>>59377727
>implying Russians don't program in Russian
>implying Chinese don't program in Chinese
They don't.
>>
>>59377904
They do, though. Nice try, Muhammad.
>>
File: string.png (53KB, 941x395px) Image search: [Google]
string.png
53KB, 941x395px
How come I can put 16 characters into this array, even though it's size is only 9 but when it's 8, shit happens? std=c99
>>
>>59378558
Data alignment on the stack.
However, your program is undefined behaviour either way, so don't do it.
Thread posts: 332
Thread images: 20


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