[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: 328
Thread images: 23

File: dpt_flat.png (102KB, 1000x1071px) Image search: [Google]
dpt_flat.png
102KB, 1000x1071px
Old thread: >>60808860

What are you working on, /g/?
>>
Eheeh
>>
Anyone else here get a sinking feeling in your stomach when you think about programming? School has ruined it for me.
>>
>>60816329
You need to program in fun programming languages, like C.
Programming in code-monkey tier langauges like Java kills all semblance of enjoyment.
>>
>>60816329

No. Programming is fun.
>>
>>60816363
I'd argue that D is more enjoyable than C.

In fact D is probably the most enjoyable language for linear imperative programming.
>>
>>60816329
if you write in sepples, java, or javascript there is no fun for you. at least C is simple even with c11 and most of the other scripting languages haven't become a shitshow.
>>
>>60816382
How much time do you spend here on average?
>>
>>60816435

Eh, depends how much schoolwork is eating into me.
>>
>>60816419

Sepples is fun tho...
>>
>>60816554
How can some one have fun in writing header files
>>
>>60816404
D is garbage. How could you have fun programming in a garbage programming language?
>>
>>60816598
How is D garbage? In comparison to what?
>>
>>60814470
That code is what a Haskellfag can't do simply.
If you can't read Lisp code then the problem is to read for integers at least 5 times, stopping at the first valid integer, and obviously returning it.
It'd be better if you made it n, but you can make it 5 if you don't wanna create an entire new function.
Oops, nevermind you have to, because the IO Monad will fuck your shit up lol.
>>
>>60816619
D is designed extremely poorly.
- Nonsensical standard library
- No target userbase or niche; the language lacks focus
- Simultaneously too high level and too low level. (garbage collected, but doesn't have the niceties of very high level languages)
- Absolutely ass-backwards features that miss the entire point of what they're trying to emulate (see 'lazy')
- Has no compelling reason to use it over anything else
- Designed over 15 years ago, so doesn't have the modern memes that are in programming languages, but doesn't come with the established base that older languages have
>>
>>60816687
>- Nonsensical standard library
It's well structured and the documentation is quite simple, easy to read and follow. I don't have any issue with the standard library and it makes sense to me as a user.
>- No target userbase or niche; the language lacks focus
That's because it's a general purpose programming language, it's not a bad thing. Language that target a specific use cases are not all that useful for general tasks: see vala, V/AHDL, vimscript etc
Although Javascript has gained much more traction than it should have.
>- Simultaneously too high level and too low level. (garbage collected, but doesn't have the niceties of very high level languages)
Metaprogramming allows you to create templates for higher level concepts. D has a good balance between high and higher level niceties while not completely forsaking performance
>- Absolutely ass-backwards features that miss the entire point of what they're trying to emulate (see 'lazy')
'lazy' makes sense to me although I don't see why anyone would actually use lazy --it's just a high level concept to hold hand to the newbies
>- Has no compelling reason to use it over anything else
C++ done right
>- Designed over 15 years ago, so doesn't have the modern memes that are in programming languages, but doesn't come with the established base that older languages have
>modern memes
We don't sell memes
>>
>>60814222
>not even always_inline inlines for some reason
Stop using a busted compiler? People don't generally use these things. I'm aware compilers aren't magic and will make mistakes but theres almost always a sensible reason why it didn't inline. It's wiser to deal with that than to make it a macro.
Using compiler specific attributes is the next step.
>>
>>60816329
Yeah I had that just after school. You just need to unlearn whatever school taught you that makes you feel bad.
>>
>>60816162
Thanks!
>>
>>60816784
Don't listen to him. It isn't the 70s anymore, there's no reason to start with C unless you already know what you're doing. C was designed for computers with literally kilobytes of RAM and even the most poorfag PC these days has orders of magnitude more than that.

There is also nothing wrong with Python. Obviously not as fast as C but it isn't as slow as people say.
>>
>>60816806
Python and basic damages your brain
>>
>>60816687
>>60816758
>memes
>>>/v/
>>
>>60816806
Blender is done in Python right? That has rendering/animation.
>>
>>60816831
>>
>>60816758
>It's well structured and the documentation is quite simple, easy to read and follow. I don't have any issue with the standard library and it makes sense to me as a user.
I've never really bothered to look too deeply into their standard library, but quite a while ago, some anon (probably you, considering we all know there is only a single D user) linked std.algorithm.searching, and it was fucking stupid. All of these weirdly specific functions, which ends up not being useful at all. All of these similarly named functions which actually did very different things. I can guess that the rest of the standard library is designed just as poorly.
Also, std.stdio.
>That's because it's a general purpose programming language
So? It doesn't mean they can't be focused. C is a general purpose programming language, but it focuses extremely heavily on systems programming, and it does an excellent job at it. Lua is general purpose, but it focuses extremely on being easy to embed into other programs, and it became quite popular for it.
>'lazy' makes sense to me
Learn what lazy evaluation actually is. D's 'lazy' is definitely not it; it's a glorified function call.
>C++ done right
C++ is shit to begin with. Why would you base it on that?
>We
Go home, Andrei. Your language is shit and hasn't gained any notoriety despite being over 15 years old. Give up.
>>
>>60816848
Oh.. Well then!
>>
So I find myself using JavaScript for some reason.
Anyways, I need to pass a value by reference into a function. The value is a member of a struct-like object.
The reason I need to do this is because Qt Qml does not support two-way binding.

So, the way I'm going about this right now is
function updateModel(model, field, viewmodel) {
model[field] = viewmodel;
propertiesChanged();
}
//...
updateModel(myStruct, "member1", memberView)

Supposing Qt QML supported two-way binding, I'd just be able to bind the model properties to the viewmodel properties without bothering with this function.

Anyways, the way I'm going about it bothers me. I absolutely fucking hate using strings as types, and using strings to search for properties. It can only be a design flaw that makes static analysis useless.
Is there a better way to do this?
>>
>>60816848
If you look into the "C++" part of it, it all falls under their 'extern/' directory, so blender is even more C than that language breakdown shows.
>>
>>60816886
>some anon linked std.algorithm.searching,
>and it was fucking stupid
Okay
>All of these weirdly specific functions, which ends up not being useful at all.
Don't use them. Like lazy evaluation, it's completely pointless if you actually know programming --I never had to use lazy evaluation in my ~7 years of experience. It becomes a problem if you have hundreds upon hundreds of useless abstractions in the standard (like C++) because it becomes hard to find and master them. On the other hand it's almost always a good idea to use modules written in the library. Probably because it has better code than yours, judging by your response pattern you are pretty young.
> is a general purpose programming language, but it focuses extremely heavily on systems programming
C is not only used in systems programming. In fact there are tons of userspace applications written in C. There are more userspace written in C than the number of kernels in the world
>Learn what lazy evaluation actually is
I know what lazy evaluation is, and it is just a glorified function call.
>C++ is shit to begin with
Which is why I said C++ "done right" :)
>Go home, Andrei
I wish I was as good as Andrei. He is an excellent programmer.
>>
How welcoming is the thread to complete noobs? I got an indian to code me a webscraper on VB for excel but the webpage has changed slightly and the scraper doesnt work. I dont know any code and cant see what it is trying to do/where it is getting stuck. Begging someone to have a look. Would probably take 2 seconds if you knew VB
>>
>>60816674
I'll do you one better. This code can return any readable type after up to 5 user inputs. Lets see you write THAT in Lisp.

readFive :: Read a => IO (Maybe a)
readFive = foldr ((=<<) . flip maybe (return . Just)) (return Nothing) (replicate 5 (readMaybe <$> getLine))

example usage:
> readFive :: IO (Maybe Int)
4
Just 4
> readFive :: IO (Maybe [Int])
[1,2,3,4]
Just [1,2,3,4]
> readFive :: IO (Maybe String)
asdf
"Hello World"
Just "Hello World"
> readFive :: IO (Maybe String)
[1,2,3]
7
5
asdf
3
Nothing
>>
>>60817029
>This code can return any readable type after up to 5 user inputs
? is that supposed to be anything special?
>>
About kotlin. What are the prospects?
>>
>>60816806

>there's no reason to start with C unless you already know what you're doing
The reason I recommend starting with C is so that you will know what the hell you're doing.

>C was designed for computers with literally kilobytes of RAM and even the most poorfag PC these days has orders of magnitude more than that.
And yet a great deal of the software running on your multi-gigabyte systems are written in C or C++. Just because C is useful for low power systems does not mean it is not also useful for high power systems.

>There is also nothing wrong with Python. Obviously not as fast as C but it isn't as slow as people say.
There is nothing wrong with Python for a number of tasks, but it is clearly not the language one should use for CPU and GPU-bound tasks. If you are developing a program that deals with lots of 3D rendering and animation, you should use a faster language.
>>
>>60817058
I'm waiting on your lisp implementation ;)
>>
>>60817076
I'm not the lisp fag but I am interested in your problem, all your program does is read 5 inputs and prints them right?
>>
>>60817074
>>60816806
Python is a terrible language for developing anything remotely complicated. It's a scientific language. It's for scripts. The moment you touch the OOP side of Python, you're going to wish you had terminal cancer instead.

t. guy trying to make a GUI in PyQt5.
>>
>>60817110
>Qt
>Python

More like
>Qt
>Anything else other than C++
lel
>>
QUICKLY! WRITE A FUNCTION TO CHECK FOR EVEN PARITY OF A 32BIT VALUE!
>>
>>60817107
No, the first n lines are mine, into stdin.
The (Just 4) or (Nothing) line is the output of the program.
>>
>>60817115
I'm not saying you're wrong, but I'm required to learn Python for work and this is the most convenient way for me to do it.
>>
>>60817029
As expected, haskellfag doesn't understand the problem.
You're supposed to read at maximum n times.
If it keeps being non integer, then keep reading until the n times read is expired.
Also, I can make my code in one line and digusting, and unreadable.
Nobody can understand your code lol.
(defun read-five (type)
(loop repeat 5 as in = (read)
if (typep in type) collect in))
>>
>>60817117
*ANDs the last bit with 1* sorry for the pseudo code
>>
>>60817135
>You're supposed to read at maximum n times.
that's exactly what is does
>has to pass in the type
oof
>>
File: 1341619539905.jpg (107KB, 613x533px) Image search: [Google]
1341619539905.jpg
107KB, 613x533px
>>60817139
>>
>>60816806
Linux is written in C. Where is your Python kernel, retard?
>>
>>60817168
Where did he say about writing kernels in python
>>
>>60817160
>readFive :: IO (Maybe type)
lmao
>>
>>60817135
These trashkell fags need to accept their language is deficient garbage.
>>
>>60817201
this
>>
>>60817139
I don't think you know what parity means.
>>
>>60817201
>>60817207
Both lisp and trashkell are utterly disgusting """languages""".
>>
>>60817188
? type annotations are option. Here the type is infered if I try to add 1 to the result:

(fmap.fmap) ((+) 1)  test
asdf
5
Just 6
>>
>>60816742
Yes, but doesn't function call overhead apply to literally all languages? I remember reading something by John Carmack, where he writes about the performance merits and when-and-if scenarios of inlining functions in C++.
>>
>>60817249
>in C++
Stopped reading right there.
>>
>>60817219
c h a r ( * ( * x [ 3 ] ) ( ) ) [ 5 ]
>>
>>60817257
Disgusting trash.
>>
>>60817186
If Python was worth anything, there'd be a kernel written with it. What does it say about a modern language when it's worst in every aspect to a "70s" language?
>>
>>60817272
>If Python was worth anything, there'd be a kernel written with it.
Wrong
> it's worst in every aspect to a "70s" language?
Wrong again. And fix your English.
>>
>>60816979
>C is not only used in systems programming. In fact there are tons of userspace applications written in C. There are more userspace written in C than the number of kernels in the world
That is not contrary to what I said.
>I know what lazy evaluation is, and it is just a glorified function call.
No it's not, you fucking idiot.
>>
>>60817219
Thanks for your opinion, Kim.
>>
>>60817305
>No it's not
Prove it.
>>
>>60817305
>That is not contrary to what I said.
So C is not a niche language
>>
>>60817219
what lang do you use
>>
>>60817314
You're not very smart, are you?
>>
File: even-odd-parity-5-638.jpg (42KB, 638x479px) Image search: [Google]
even-odd-parity-5-638.jpg
42KB, 638x479px
>>60817214

A bitwise AND with 1 would be an optimal method to check a parity bit...
>>
>>60817305
Lazy evaluation IS a function call, junior
>>
>>60817284
Your arguments are baseless, as is your strawman. Enjoy your codemonkey language written for the lowest common denominator, with its only merit to speak of being its supposed ease of use.
>>
>>60817326
Thanks, Kim.
>>
>>60817333
This is incorrect.
>>
>>60817347
>Your arguments are baseless
Usefulness of a language is not measured by the fact that kernels are written in it
>>
>>60817348
Well, that's even more sad.
>>
>>60817333
>>60817353
Prove it.
>>
>>60817322
I didn't say C was niche, I said it was focused.
>>
>>60817392
>focused
More userpspace C projects exist than kernels
>>
/dpt/, what is one practical between a promise and a nullary closure? i know they're not necessarily implemented the same way but regardless they really seem like the same thing
>>
>>60817401
"Systems programming" expands beyond just kernels, you know.
>>
>>60817431
i know systems programming too!
ls
>>
>>60817333
Calling lazy evaluation a ``function call'' is a gross oversimplification. While function calls are an essential element in lazy evaluation, it would be asinine to conflate lazy evaluation with a function call.

The core of lazy evaluation is that data is generated only when needed, instead of beforehand. A getter function is not lazy evaluation.
Lazy evaluation allows you to do new things that were previously impossible. Without the concept of lazy evaluation, you wouldn't be able to represent an infinitely long list using the traditional implementation of one.

The most important part of modern implementations of lazy evaluation is a closure that allows you to keep track of state for when you need to use the same function to get new data.
>>
>>60817328
>Check a parity bit
>Still don't know if it's right
Good job
>>
>>60817117
>>60817328
I thought parity went like this? At least this is how my digital logic teacher explained it.
int checkParity(unsigned value32, unsigned parityBit) {
unsigned i, sum;
/* sum every bit of the value*/
for (i = 0, sum = 0; i < 32; i++) {
sum += (value32 >> i) & 1;
}
/* the sum and the parity bit should add to be even since this is even parity. */
return (sum+parityBit)%2 == 0;
}
>>
>>60817358
Keep telling yourself that. Because as it stands, Python is good for:
>ease of use
>easy to use
>good for beginners
>easy for beginners
>"pythonic"
>etc
And don't get me wrong, I don't even know C, only Python. But I know enough Python to know it's a piece of shit.
I mean, it's so convoluted to reverse a ranged object in Python that, e.g.
range(10)
range(9, -1, -1) # reversed

That you actually have people resorted to calling the reversed() function in their code (I see it all the time), like so
reversed(range(10))

and adding a redundant function call. The very same people praising Python for its "ease of use" are too braindead to figure out how to reverse range(). What does that say about the language?
>>
Why is "my IP or IP range blocked" when I try to reply, but when I change what my reply says, I'm magically not blocked anymore?
>>
>>60817489
Well what the fuck do you need a parity for anyway, a single serving is enough for most people (pair-a-tea)
>>
>>60817497
>Keep telling yourself that. Because as it stands
Huh? How is usefulness even remotely related to kernel development?
>>
>>60817117
#include <stdint.h>

int even_parity(int32_t i32)
{
int p = 0;
for(int i = 0; i < 32; i++)
{
p = p ^ (i32 & 1);
i32 = i32 >> 1;
}
return p;
}
>>
>>60817498
Cloudflare has some weird filters on it.
For example, you can't post
ls (dash)l
, with (dash) replaced accordingly.
>>
File: disgust.png (156KB, 318x427px) Image search: [Google]
disgust.png
156KB, 318x427px
>>60817515
>>
>Implement smart method to do connected component analysis
>Project manager wants us to do it the old fashion way and run through every pixel
Eat a fucking dick.
>>
>>60817214
If it returns 1 then that means it isn't even parity. There has to be a parity bit of 1 for it to have even parity.
>>
>>60817475

>>60817353 doesn't seem to agree. Lazy evaluations are just another abstraction over function calls.
>>
/dpt/ is it possible to programmatically write an arbitrary strength electrical signal to a specific bit in memory?

Use case: I want to write a simple but effective random number generator that works by storing a static volatile int whose bits are all electrically "fuzzy" so that reading them will produce uniformly inconsistent results at the hardware level
>>
>>60817489

Well if you want to check if it's CORRECT, and not just if it's set, just check to make sure the popcount is even. The parity bit is really just a correction bit, forcing the popcount to be even if it isn't.

pub fn has_even_parity(x: i32) -> bool {
let popcount = x.count_ones();
popcount % 2 == 0
}
>>
File: 1373739459432.jpg (54KB, 800x804px) Image search: [Google]
1373739459432.jpg
54KB, 800x804px
>>60817517
I bet if you
$ grep 'reversed(' *
your Python code, there'd be a match.
>>
How come when I pop my circular, it doesn't get modified.
I can just pop it forever.
>>
>>60817622
I'm glad you also know what it means, you moron.
>>
File: elements of programming.jpg (13KB, 227x346px) Image search: [Google]
elements of programming.jpg
13KB, 227x346px
Is it any good?
>>
>>60817638
>How come when I pop my circular, it doesn't get modified.
Dunno, but:
>I can just pop it forever.
This is a desirable property of a circular. But not if you mean you can just pop it forever and get the same result every time. That's a bug.
>>
>>60817651
How does this run under the hood.
>>
>>60817610

Sorry, there are no CPU instructions for doing that on any modern architecture.
>>
>>60817651
What about pushing though.
>>
>>60817117
bool even_parity(uint32_t n)
{
for (uint32_t i = 16; i > 0; i /= 2)
n ^= n >> i;

return !(n & 1);
}
>>
>>60817638
That's because pop overwrites the list with the cdr of the list, but that cdr was also the list...
and it goes on and on
>>
>>60817660
Depends on the language and implementation you're using. It could be an array-based circular buffer, or it could be a linked implementation with the last element's link part pointing to the first element, or it could be a linked implementation where instead of a list, each link part points to a promise that returns a list, or it could be a queue that pushes every element it pops. There are probably other ways of doing it too.
>>
>>60817665
Drat. Well, thanks.
>>
I'm trying to learn C#, what kind of shitty code do any of you want to see, what should I program?
>>
>>60817777
Soda pop plus electric razor, if you catch my drift. ;^)
>>
just found out about efi.h

/dpt/ should i write a shitty os that's so garbage it doesn't even boot, you turn on your computer and then it just "is" because the whole thing is efi code

i mean it would have basic things like a text editor and a filesystem but obviously those things would have to be really minimal to fit in the 100mb or whatever the fuck
>>
I'm a complete noob at programming, I barely know some C.
What am I supposed to do, in order to start making money? Be it my making an app or whatever way. And how long could it take?
>>
File: 1490269136509.jpg (118KB, 390x600px) Image search: [Google]
1490269136509.jpg
118KB, 390x600px
>>60817843
>a shitty os that's so garbage it doesn't even boot, you turn on your computer and then it just "is" because the whole thing is efi code
>basic things like a text editor and a filesystem but obviously those things would have to be really minimal
So... Grub?
>>
>>60817610
If you develop a TPM that handles RNG like that, you'll make some cash 8)
>>
Are the language specific Hackerrank problems worth doing with the intention of getting attention for employment? They're all so trivial, I'd rather do something else than fill all these out.
>>
Just finished coding at code academy. Learned the introduction to javascript.


//I learned this in an hour
console.log('hello', 'faggot')
console.log(3+5);
console.log(Math.random() * 100);

//That's about it. I'll try step two later

>>
>>60817876
>C
>money
Do you really want to maintain legacy trash written in Cpaghetti?
>>
>>60817876
>c

lol, that's for hardware level shit. You want to make applications? Learn Python or/and Java.
>>
>>60817117
surprisingly efficient
    generic
type Object is (<>);
function Parity (Item : in Object) return Object;

function Parity (Item : in Object) return Object is
type Bit is mod 2;
type Word is array (1 .. Object'Size) of Bit with Pack;
function Convert is new Ada.Unchecked_Conversion (Object, Word);
function Convert is new Ada.Unchecked_Conversion (Bit, Object);

Parity_Bit : Bit := 0;
Object_Bits : Word := Convert(Item);

begin
for I of Object_Bits loop
Parity_Bit := Parity_Bit xor I;
end loop;
return Convert(Parity_Bit);
end Parity;
>>
>>60818252
What does this mean?
>>
File: smug-cat.png (15KB, 147x228px) Image search: [Google]
smug-cat.png
15KB, 147x228px
>>60818201
>the first thing Code Academy teaches their JavaScript students is that they're faggots
>>
>>60818245
Python is for making SCRIPTS, not ``applications". And Java is good for large projects, but it's still too slow for real-time stuff like AI.
>>
I find pythons string library very convenient. But I like C much more.

Is there something similar to pythons string library for C? Or do I have to write it myself.
Splitting into lists based on delimiters is a godsend for parsing. Especially in C where you have to do null termination.
>>
>>60818333
Write your own.
>>
What is the best way to learn openCV?
So far I've just been using youtube videos, but If there's a better source i'd prefer it
>>
>>60818306
What do you mean?
>>
>>60818344
>Write your own.
I suspected I would have to do that.
>>
>>60818333
>>60818369
>Splitting into lists based on delimiters
I thought strtok() in a loop could do this? Just make a function split_by_commas or whatever, that wraps this.
>>
>>60818348
Can you explain why this is so long?
Explane the code to me, I don't know Ada.
>>
>>60818347
READ THE OFFICIAL DOCUMENT YOU FOOL
>>
>>60818409
Do you mean splitting a string and returning an array of substrings broken up by a delimiter?
This is trivial to write in C, and it would just be a specialized use of strtok.
>>
>>60818208
>>60818245
That's why I asked
>what
should I do to start making money, in any way programming related. I never implied I wanted to use only C. I want to know what languages are the most important to learn and how long does it take until I start making some serious dosh.
>>
>>60818321
You don't know anything about programming, do you?
>>
>>60818333
>Splitting into lists based on delimiters is a godsend for parsing. Especially in C where you have to do null termination.
C strings are just arrays, so the idiomatic way to process strings in C is to iterate over them.
#include <stdlib.h>
/* split
Splits str by delim. Result is a null-terminated array of strings.
Must be freed by caller. */
char const** split(char const* str, char delim) {
char const** retval = malloc(1);
int size = 1;
for (; *str; str++) if (*str == delim) {
retval[size - 1] = str;
retval = realloc(retval, size++);
}
retval[size - 1] = 0;
return retval;
}
>>
>>60818447
Oops, should be ++size, not size++
>>
>>60818430
>getting into programming for money
Just blow your brains out now, it will save you the 20 year future of misery
>>
>>60818447
Might want to remind him to free() the substrings when finished with them, especially if it's a long-running program.
>>
>>60818412
I over engineered it to make it generic for any input, even arrays. The first block defines the generic contract, so you give it a type to elaborate the function. The second block defines 2 types, one is a bit, the other is a bit packed array, and since Ada is strongly typed I added conversions to and from these local types. The actual algorithm is only 3 lines.
>>
Is programming a brainless enough job that I'll be able to do it without eating? I'm fat as fuck and need to lose weight, and fasting is the only way to do it where severe depression is actually an asset -- but I need to not have to function on a very high level, because eating is how I keep my autism and trauma at bay long enough to do basic things like talk to people.
>>
>>60818486
>Is programming a brainless enough job that I'll be able to do it without eating?
Not for me personally. With a minor headache I don't really get anything done.

Sounds a bit extreme to change career because you're changing diet though.
>>
>>60818474
You don't have to create substrings or even a multi-dimensional array, just create a flat array and access array members through multiplication.
>>
>>60818486
Just kill yourself. That would be a better option for your kind.
>>
>>60818486
When I started living alone, I hardly ever ate, mostly because I would only cook once every other day and had plenty of leftovers so I'd eat much less than my maintenence calories, I lost 70lbs.
>>
>>60818447
>>60818454
On second thought, disregard that function completely, it doesn't even work at all. Too tired right now to write one that does.
>>
>>60818486
programming above pajeet level requires eating enough to fuel your brain and also to get caffeine or taking harder drugs like adderall. there are programmers who stay in decent shape for example john carmack but for example gabe newell and mike acton are big guys for you.
>>
>>60818563
Gabe probably hasnt programmed in two decades.
>>
>>60818412
http://www.tutorialspoint.com/compile_ada_online.php?PID=0Bw_CjBb95KQMQnhxZ2tQRkNOQlU
>>
>>60818563
>or taking harder drugs like adderall.
fuck off brainlet
if you can't sit down at a computer for 10 minutes without ingesting drugs, you're mentally retarded
>>
>>60818631
i don't take drugs besides caffeine but some people do
>>
>>60818486
Ever heard of RMS?
Great programmer.
Fucking spherical.
Do something like manual labor instead.
>>
i think you need to take really good care of your physiological needs like eating, fapping, sleeping and exercising in order to unlock your truly unlock your programming potential. there are huge differences in the programming abilities of different people as well as the same person at different stress levels.
>>
>>60818673
>RMS
>Great programmer
the only thing he's famous for is being mentally ill
>>
>>60818507
This x100. Greedy pigs don't deserve to live. Please end it, you would be doing a huge favor to the overburdened society of woefully skinny working class men who've had to carry your fat ass this far. If there's an afterlife, this is your last chance to get the good one.
>>
File: DSC01780.jpg (82KB, 1024x685px) Image search: [Google]
DSC01780.jpg
82KB, 1024x685px
>>
>>60818704
>what is gcc
>what is the gpl
>>
What is the best way to convert a bmp to png using C with a single file library or without any libraries at all? Will one of the stb libraries work?
>>
>people who argue that code isn't "pythonic" or doesn't follow "best practices"
Monkeys.
>>
>>60818840
>Will one of the stb libraries work?
Yes. stb_image
>>
File: asdasd.png (99KB, 1050x808px) Image search: [Google]
asdasd.png
99KB, 1050x808px
>>60816224
>What are you working on, /g/?
Going to start projecteuler from the beginning, I think.
With muh first account I got up to problem27 with python, but relied on a lot of shit that python has already implemented which made it a lot easier. Now going for C, try to document shit and just try to keep motivated
>>
>>60818832
>gcc
Yeah the important bits of that is not written by RMS. And it's not even good to begin with.
Your standards for compilers are just low.
>>
>>60818871
Language becomes irrelevant on the later problems. It's only the stupid entry level "sum 1+2+3+...+n" type problems that you might have an edge because of the use of python
>>
>>60818896
Well maybe then I might just going on with problem 27.
>>
File: IMG_20170609_105355.jpg (2MB, 3264x2448px) Image search: [Google]
IMG_20170609_105355.jpg
2MB, 3264x2448px
>>60816224
>What are you working on, /g/?
Still working on a Wayland compositor backend. I just fixed this troublesome rendering bug.
>>
>>60818724
nice
>>
>>60818998
What does this do? Will it allow existing DEs and WMs to be ported to Wayland more easily?
>>
>>60819018
hes implementing wayland server
>>
>>60819018
>Will it allow existing DEs and WMs to be ported to Wayland more easily?
X11 and Wayland are fundamentally different. It's just not going to work like that.
This is a new backend for an existing wayland compositor, because the old one is kind of crap. If I tell you what compositor it is, you could probably pretty easily find out who I am, and I've probably already given too much information.
It's very early in development at the moment. Currently we're just drawing cats.
>>
>>60818832
>gpl
Complete trash.
>>
>>60818871
>muh
>>>/v/
>>
>>60819102
>t. bsd cuck
>>
>>60819222
>t.
>>>/b/
>>
>>60819258
https://en.wiktionary.org/wiki/terveisin
>>
>>60819300
What was this post meant to demonstrate?
>>
gate-keeper, do you use a bot?
you really should if you dont
>>
>>60816806
>Don't listen to him. It isn't the 70s anymore, there's no reason to start with C unless you already know what you're doing.
For learning, the bottom up aproach has been superior for eons. No difference with programming
>>
>>60819471
Its better to learn the right way first and then go back and see how it was done wrong than vice-versa.

Anyone advising C as a first language is giving bad advice.
>>
>>60819498
This is one of the most retarded posts I've been here today.
>>
>>60819498
>Its better to learn the right way first and then go back and see how it was done wrong
This is completely irrelevant to language choice unless you consider language choice a binary right and wrong choice.

C is a good starting language because it's a simple language, it teaches you things other languages generally don't and enables you to step back to it and call out to it via FFI in a lot of languages.

Becoming a "C expert" isn't required for it to be your starting language.

I also think that if you've gone through C as a rookie you will learn to appreciate abstractions in a different way that encourages you to write your own API better. Something people lack a lot of the time. API design isn't even taught in schools (if we exclude POO).
>>
Why would anyone recommend a systems programming language as a first language to people who want to develop userspace applications (most dev jobs)?
>>
@60819508
>no effort in refuting
(You)

>>60819520
>This is completely irrelevant to language choice unless you consider language choice a binary right and wrong choice.
There are same languages that are bad to start with that give you bad habits, C and Python are two examples on opposite sides.
>>
>>60819498
I've been TAing for a few semmesters now, and I can tell you, that the students who only knew a high level programming languve before college, do worse on average than those who didn't even knew programming. (This is a Intro to programming 1 class in C)
Also what>>60819520 says, C is a very simple language, it's easy to learn all of it quickly, so you can focus on techniques rather than language components.
>>
>>60818880
gcc is still one of the top compilers
>>
>>60819549
>refuting
Anon you didn't even make a case.
>bad habits
So you think programmers only know one language and should stick to that language for all eternity?
Also I disagree that these are bad habits. They're modes of thinking. You need to learn to change that if you're gonna be a good programmer.
>>
>>60819588
Yes it's impressive how much junk ends up at the top in software.
>>
>>60818880
>LLVM/clang retards have attempted to supplant gcc for nearly 10 years
>gcc still produces much faster programs
>linux kernel doesn't even compile under clang even though it's been a stretch goal for ages
>>
>>60819604
in what way is it junk?
>>
It actually doesn't matter what language you start with.
>>
>>60819547
Because if you don't understand what's happening at the systems level you're going to write extremely bloated, shitty, buggy and slow applications.
>>
>>60819614
>>linux kernel doesn't even compile under clang even though it's been a stretch goal for ages
this is the funniest part because the clang shills claim that it supports gcc features but it's not true and they just ignore certain attributes as it recognizing the syntax but disregarding the functionality counts as supporting it
>>
>>60819614
>llvm
Who said I'm for LLVM?
>>60819615
It's an incredibly unhelpful compiler not only to people who just compile programs with it but also debugging. People make all kinds of excuses about the debugging part but it's really terrible completely on its own accord.
>>
>>60819635
>as it
as if
>>
>>60819622
good luck starting with python or javascript and then going on to become a successful C++ developer
>>
>>60819622
It does. You can start with a terrible language and be harmed by that.
>>60819547
>userspace applications
They're not that different from systems unless it's just a window that presents some JSON you fetched from a server.
But a lot of people don't realize because they write terrible software and think they're doing something way simpler so it doesn't have to be great.
>>
>>60819627
You're going to write extremely bloated, shitty, buggy and slow applications either way. Knowing a systems programming language is not going to help with that.
>>
>>60819641
>debugging
Why should the complier also do debugging? That's what gdb is for
>>
>>60819667
If you didn't know the compiler has to emit debug information for the program to be able to be debugged conveniently.
>>
>>60819661
I meant in the long run it doesn't matter. Short-term, you should just learn whatever is relevant to what you're trying to do.
>>
>>60819657
It's not that difficult to learn multiple programming languages. You're just an idiot.
>>
It doesn't matter what language you start with so long as it's a statically typed one.
It's really fucking hard to relearn programming with static typing after coming from a dynamic language, it changes everything, and suddenly, you're not longer allowed or encouraged to chain long strings of .split().map().filter().reduce().join() to solve all your problems.
>>
>>60819699
you realise you can still do that right
>>
>>60819689
99% of python and javascript """"programmers"""" are beyond awful. they get into terrible mindsets and habits
>>
>>60819725
And they would've done so no matter what language they started with.
>>
>>60819680
Yeah but sadly learning while on a job is an exponential function of time. If you start just slightly further along you'll end up at a way better place.

There's very old people in this industry who don't know a whole lot.
>allowed or encouraged to chain long strings of .split().map().filter().reduce().join() to solve all your problems.
That's not what I'd consider a problem with dynamically typed languages, and it can clearly be done productively in statically typed languages.
But I agree that statically typed languages are much better for learning programming as a rookie. Languages like scratch follow similar ideas in their interface for good reasons (the blocks have shapes you need to explicitly convert to or you would have to realize you're using the wrong block).
>>
>>60819730
>And they would've done so no matter what language they started with.
Ok find us a bunch of examples of systems programmers who get into awful habits the way these programmers do? Because they should be there if what you say is true.
>>
>>60819730
nice black and white thinking sperglord

it objectively makes a difference to start with a different language, more or less
>>
>>60819725
>99% of python and javascript """"programmers"""" are beyond awful
>>60819748
>nice black and white thinking sperglord
Lol?
>>
>>60819761
t. delusional javascript shitter
>>
>>60819761
>hyperbolic portion of programmers in language are bad
You claim
>All of these programmers would be bad in any situation, there's no causation here!!!!
>>
>>60819773
Maybe the causation is the other way around.
>>
>>60819745
Shit code gets rejected from the kernel all the time.
>>
>>60819773
Not the same person, but

>All of these programmers would be bad in any situation, there's no causation here!!!!
This is beyond true. Python and Javascript (and Java and C++) are all very popular languages, they are taught in school, and required by a lot of jobs. The larger the population, the more shitties (totally) infest it. The more jobs with these languages, the more likely there are to be people who don't really like or care enough about programming to learn how to do it well, they are just there for the job.

So how do you justify, even anecdotally, how those languages make a programmer bad? If you can even provide a reasonable mechanism for it, how can you honestly believe that to be the case?

>>60819796
This is also a good point.
>>
to any serious C/C++ developer, languages like python are obviously brain cancer

just look at this shit:

conditions = (check_size, check_color, check_tone, check_flavor)
checks = (condition() for condition in conditions)
return next((check for check in checks if check), None)
>>
>>60819827
>This is beyond true
What did she mean by this?
>>
>>60819840
>C/C++
>>
>>60819850
typical shitlang """"""""""""""programmer"""""""""""""" behavior, lacks the rigor to recognize that something can't be "beyond" true, whereas a real programmer would assert that something is "absolutely" true or something along those lines
>>
>>60819850
I'd say the statement is ~120% true.
>>
>>60819827
>So how do you justify, even anecdotally, how those languages make a programmer bad?
Because my experience with python programmers is worse than with other programmers in general.
Since they're proportionally more common than programmers in general the language has to be making programmers worse.
Alternatively as you mention maybe it's selection bias because bad programmers pick python. I don't quite see how that'd be possible though.

I feel the opposite with C. Excluding people who are obviously very new people who write actual software in C are in my experience good programmers. We might not agree on everything but I can see they have motivations for why they do what they do. With python programmers they seem very brainwashed and defend themselves by saying "that's not pythonic!" or whatever buzzword they prefer at the moment.

I just assume it was the languages that make them bad but maybe you're right and they just swarm to the rotten fruit like flies.
>>
>>60819946
>Since they're proportionally more common
Bad python programmers, not programmers in general.
>>
>>60819946
>because bad programmers pick python
I don't see how anyone could possibly deny this assuming they believe python to be absolute garbage.
>>
>>60819840
So, if I'm reading this right, what's going on here is that
conditions is a tuple of functions
checks is a tuple of return values (which may or may not be the same type)
the return function returns all non-null values. Probably as a tuple. I don't know what next() does.

Having said that, that was indeed eye cancer and hope I never have to read shit like that again.
>>
>>60819960
There's a difference between new programmers and bad programmers though. A new programmer doesn't know enough to judge. But a bad programmer will pick and stick to a bad language. They won't form the opinion that it's shit.
>>
>>60819960
python gets shoved down naive people's throats as their first language
>>
>>60819977
If that person isn't severely mentally ill they'll discover that python is garbage pretty quickly.
>>
>>60819840
Okay.
First line lists the check functions to be completed
Second one is a function application mapping
The third one I think is supposed to return the result of the first check that returns something (i.e. check didn't pass)

>>60819946
>Because my experience with python programmers is worse than with other programmers in general.
Yeah, see that's not a mechanism, that's a baseless assertion.
>>
>>60819985
>see that's not a mechanism
You asked for anecdotal. It's my experience. Of course I haven't measured and verified a theory on this. Neither have you.
Maybe >>60819971 is what you're looking for? That's just speculation though. I have absolutely nothing to back up the idea that good programmers should stay away from bad languages other than my own ideas about programming, which may be super specific to me and might not really apply to general programmers.
>>
>>60819968
https://stackoverflow.com/questions/36117583/pythonic-way-to-avoid-if-x-return-x-statements/36129322
>>
>>60819977
>>60819960
There's nothing wrong with using Python as a first language.
First of all, this is assuming you never touch OOP. If you want to teach OOP, use a language that was designed specifically for that.

Python has forced indentation of code. This means that stupid kids will ingrain the concept of proper coding styles as early as possible. I have lost count of how many people I have seen crash and burn because they can't indent worth shit. They don't keep their braces in order, they don't even bother tabbing, so they lose track of scope.

Making orderly code a requirement will eventually cause them to feel as if something is ``wrong'' when they see poorly formatted code. This improves programmers because they will be better at keeping track of execution flow.

Python does not have GOTO. N

>>60820007
Oh my fucking god I am so mad
>>
>>60820007
>263 up arrows
Crazy. I know 'suck it up' answers aren't exactly allowed on stackoverflow but you'd think someone would have come up with something decent.
Maybe this is all just a joke?
>>
>>60820005
>good programmers should stay away from bad languages
A good programmer isn't easily deluded when it comes to programming. Studying shit languages can actually be pretty interesting.
>>
>>60819984
a linux user might think that windows is shit and that windows users just don't know any better. likewise, a windows user might think that linux is shit.

people tend to stick with what they're used to and what they're good at.
>>
>>60820017
>If you want to teach OOP
Ignored your entire post.
>>
>>60820029
"python is shit" is a self-evident statement to any non-retarded mind. Your examples with linux and windows would require proof.
>>
>>60820017
>indentation
I don't see why this would be something to bring up really. It's so irrelevant.
People learn this when you force them to. It can't take long to fix this I imagine.

I don't mind the indentation in python but it shouldn't be mentioned like a pro here.
>>
>>60820029
Windows is shit. Everythin is faster on Linux. That's a fact. NT algorithms suck.
>>
>>60820019
>someone would have come up with something decent
>>Don't change it
>>There are other ways of doing this as the various other answers show. None are as clear as your original code.
80 upvotes.
That's something at least, but it's clearly not enough.

I'm surprised nobody pointed out that this is generally a sign of larger design problems.
>>
>>60820007
With function definitions, this could be more readable.

conditions = (check_size, check_color, check_tone, check_flavor)
def head(iterable):
return next(iterable, None)
def exec(func):
return func()
return head(filter(None, map(exec, conditions)))


I find it odd that a function call is not in operator.*
>>
>>60820049
Why can't you faggots stick to a containment thread elsewhere and not shit up /dpt/ with the same fucking thing every day, hm?
>>
File: 1466292531913.jpg (1MB, 3840x2160px) Image search: [Google]
1466292531913.jpg
1MB, 3840x2160px
>>60820035
Not teaching OOP is like letting a retarded child out into the world.

>>60820050
You have to keep in mind the level of people we're trying to teach here. They would know literally nothing. They would think things like "the next line of code being executed is on the next line", completely oblivious of the control flow denoted by the ifs and loops.

Without indentation, stupid people aren't going to be able to keep track of things. When people have trouble with something so fundamental, the problem is the way you're teaching it.
>>
>>60820078
Obviously that means that this is our thread. Maybe you should fuck off somewhere else instead.
>>
>>60820087
Why would anyone in their right mind teach someone POO? I guess it's fine if your goal is to teach them how to make shit software.
>>
>>60820073
Even better
conditions = (check_size, check_color, check_tone, check_flavor)
return reduce(lambda x, y: x or y, map(lambda x: x(), conditions))

Only brainlets couldn't read this code.
>>
>>60820087
So? Tell them about loops and they're done with it. Don't you think it'd be better to have people use brackets/endofscope markers then to enclose a scope. They'd immediately run into issues using that mentality if they didn't use blocks appropriately. Block are much more clear. Making stuff that's normally insignificant significant in a language will confuse you in other languages.
Python indenting is very different from normal indenting visually in a lot of cases. Even if you technically use the same style the lack of closing bracket/end markers gives a very different reading experience to.

So I don't see how python beats C in this.
>>
>>60820122
Why would anyone in their right mind teach someone functional programming? 90% of the codemonkey jobs people wind up in would never use it.

And yet we teach it anyway, because in our infinite wisdom, we figure that there is probably some value in doing so.
>>
>>60820140
>code
Your kind isn't welcome here.
>>>/g/wdg/
>>
>>60820148
>functional programming
Not that guy anon but your opinion is invalidated the moment you propose functional as the option to OOP. Clearly you don't know enough to partake in this conversation.
>>
>>60820152
Well it's not a full program. So what do YOU call the text of written programs?
>>
>>60820148
Where does my post mention "FP"? You're delusional and/or retarded if you think it's somehow the opposite of POO.
>>
File: Capture.png (7KB, 320x351px) Image search: [Google]
Capture.png
7KB, 320x351px
>>60816224
I wrote a question for the underclassmen programming contest. It was pretty simple, just mostly an annoying parsing challenge.
Think it would be an appropriate bullet point on my resume?
>>
>>60820157
>""functional as the option to OOP""
>""option""
Perhaps >>>/g/wdg/ is a better thread for you.
>>
>>60820141
You're still overestimating the level of people we're trying to teach. People aren't going to be able to figure it out in one. I'd share you a programming assignment one of my classmates did way back when I was still a freshman, but that's long gone.
Anyway the closing braces looked something like this
}
}
}}
}


}

Confused yet? This is how early CS majors program. In the stupidest way possible. Never underestimate stupidity.

If there were a language with brackets that also enforced indentation (god help us all), I would teach people using that language. Of course, because that doesn't exist, it would seem more proficient to write a static analyzer to break compilation for me.
>>
File: ughh.png (699KB, 622x570px) Image search: [Google]
ughh.png
699KB, 622x570px
#!/usr/bin/env nodejs
>>
>>60820176
What is it supposed to do?
>>
>>60820189
>we
Speak for yourself. I don't associate with retards.
>>
>>60820167
>>60820157
Here come the FP autists who can't read a full sentence to save their lives.

I'm not going to explain such a simple argument to you morons, it would be lost effort.

IN SHORT: Not teaching a fundamental paradigm would be a disservice to the ones being taught. Learning more paradigms is always useful. If you're not retarded, you would see the value in learning FP even though you would never use OCaml in the workplace. If we take this logic and apply it to its logical extreme, then OOP is worth learning for the same reason.

If you still don't see the meaning in this, just quit your jobs now, you don't belong in this field.
>>
holy shit who thought php syntax was a good idea
>>
>>60820213
>FP autists
I despise ""FP"".

There are only two reasons for learning POO, creating shit software and learning the absolute worst way to accomplish something.
>>
File: 1371956854343.png (190KB, 550x550px) Image search: [Google]
1371956854343.png
190KB, 550x550px
>>60820233
This is surely why Bubble sort is never taught in schools, nope not at all.
>>
>>60820245
The human brain is capable of many illusions.
>>
>>60820213
Ok anon go learn brainfuck and the mindset required to write programs as effectively as you can in brainfuck. Was that productive? Yes. It's far more productive than learning OOP.
It's a horrible time investment and you will never find yourself without better things to learn.
>FP autists
Again, nobody mentioend FP. Calling FP the alternative to OOP is for people who don't understand OOP (which I'm fine with you not understanding), FP (which I'm not fine with you not understanding) and popular alternatives like imperative programming which most certainly is the option you'd go for if you're from an OOP background.

OOP programmers rarely do smalltalk, if smalltalk was the norm I'd be fine with you considering FP the alternative because it's not just a theoretical similarity at that point it's a practical similarity.
>>60820245
Fuck off, bubblesort is taught because it's an intuitive sorting algorithm that can be used to let people understand that they're actually doing an algorithm when sorting things. Which isn't obvious to a lot of people. I imagine they view it as "I pick up the right item and put it in the right place". Which clearly isn't the case, people sort things subconsciously and presenting a very simple algorithm helps break that perception.
>>
>>60820191
Bear in mind it was for newer students
You're given through stdin an line of space delimited integers and a line of operators to apply to them left to right. Multiple sequential operators are reduced by just appending the number of times to apply the operator.
1 2 4 6 5 6 4
+-3/*

evaluates to -8

I designed the question, a handout for it, sample solution, and test data sets.
>>
>>60819840
firstTruthy :: Monad m => (a -> Bool) -> [m a] -> m (Maybe a)
firstTruthy f = foldr
(\x r -> x >>= uncurry (bool r) . (return . Just &&& f))
(return Nothing)
>>
>>60820176
>>60820270
I say it's not worth it.
>>
>>60820270
Seems like a cool little project for beginners. Introduces, but shields them from typical infix calculator project parsing and all that entails.
>>
why is every language fucking oop
learning php and even this has it
/g/ told me oop was a meme
>>
>>60820290
you can remove the x and just do an operator section
(\r -> (>>= ...))
>>
>>60820290
>>60820316
actually you might have to flip that

also you can probably generalise the [m a] to Traversable t => t [m a]
>>
>>60820315
there is nothing wrong with objects as long as they're not overused
>>
>>60820315
Right. OOP fits the actual definition of a meme. It's fucking pervasive.
You need to use languages that stayed pure, like C.
>>
>>60820327
*t (m a)
>>
>>60820315
>meme
>>>/v/
>>
>>60820336
http://www.planetpdf.com/codecuts/pdfs/ooc.pdf
https://developer.gnome.org/gobject/2.52/
>>
>>60820341
>>meme
> >>>/v/

>>>/x/
>>
>>60820327
I think flipping it actually makes the code longer. You're right about Traversable, I just have an old ghc.
>>
>>60820315
Never fall for /g/ lies.
>>
>>60820347
Those are just shitty libraries, not part of C.
>>
>>60820293
Fair enough. I could always mention it as a supplementary bit in an interview if it's already going well.
>>60820306
That's what I thought. It actually tripped them up a bit because most of the teams saved it for towards the end and the parsing is easy to mess up. More pedantic than anything.
>>
>>60820361
>shitty libraries
As if there is any other kind.
>>
>>60820351
you're probably right
>>
>>60820264
Why are you so fixated on FP? I only mentioned FP because it's the most popular paradigm that is not imperative or OOP. Jesus, think outside the box a little.

Yes, people teach brainfuck in a classroom setting. Brainfuck is the classical introduction to compilers. Are you finally seeing what I mean by ``all paradigms are worth learning''?

Even Malbolge can be worthwhile because it goes to the farthest extremes in obfuscation. If it wasn't so impossible, I'm sure it would hit a few landmarks in a security class somewhere.

If you think that bubblesort is taught for a good reason, how is it so fucking impossible for you to think that OOP is taught for a good reason? OOP is an intuitive way for brainlets to break a larger problem into smaller problems, and is probably going to be a CS student's first encounter with meaningful code reuse.

You don't hate OOP because it encourages bad design. You just have blind rage for it because a language ideal for teaching stupid brainlets also happens to be a perfect language for stupid brainlet masses to write terrible programs in.
You don't stop even for a second to think what someone might gain from it and only think of the consequences. Your pessimism is outstanding.
>>
>>60820290
lmao you guys suck
(remove-if-not #'identity 
(mapc #'condition `(,check-size ,check-color ...)))

>>
>>60820270
rep :: String -> String
rep [] = []
rep (x:xs) = case reads xs of
[(i, xs')] | i > 0 -> replicate i x ++ rep xs'
_ -> x : rep xs

popF :: (a -> a -> a) -> [a] -> [a]
popF f (x:y:xs) = f x y : xs
popF _ xs = xs

go :: String -> [Integer] -> [Integer]
go [] = id
go (x:xs) = (go xs .) $ case x of
'*' -> popF (*)
'+' -> popF (+)
'-' -> popF (-)
'/' -> popF div
_ -> id

run = go . rep
>>
I've just realized rust has two traits in the standard library for abstracting the reference taking with exactly the same signatures, once you factor the different method names out:
https://doc.rust-lang.org/std/borrow/trait.Borrow.html
https://doc.rust-lang.org/std/convert/trait.AsRef.html
I mean, even examples are the same. And it's not an oversight, the documentation refers to each over. Like, why would they do that, why the fuck not make a single trait.
>>
>>60820410
lmao you suck
(position-if #'identity
(mapcar #'condition `(,check-size ,check-color ...)))
>>
File: 1496891277232.png (163KB, 531x325px) Image search: [Google]
1496891277232.png
163KB, 531x325px
>>60820410
>>60820454
horrible!!! that's pornography?
>>
File: networking.jpg (156KB, 1352x613px) Image search: [Google]
networking.jpg
156KB, 1352x613px
>>60816224
>He's not using a dimmed colorscheme
>>
File: 1465344167068.jpg (19KB, 640x360px) Image search: [Google]
1465344167068.jpg
19KB, 640x360px
>>60820466
cover your eyes!
>>
Why does it not place them decrementally on the stack!?

int a = 2;
int b = 3;

gcc translates to asm as

movl $2, -16(%rbp)
movl $3, -12(%rbp)


when logically the stack grows downwards to the lower adress so it should had been

movl $2, -12(%rbp)
movl $3, -16(%rbp)
>>
>>60820493
Wrong.
>>
>>60820503

what do you mean wrong, you smartass?
>>
>>60820482
>"20" ++ "17"
>he uses new in C++
Have you not watched Sutter's talks? There is no use for `new` in the modern C++.
>>
>>60820508
>There is no use for `new` in the modern C++.
wat
>>
I just realized I don't know how to make big programs.
My head is literally empty, performing background computations.
Works great with small problems, but how the fuck am I supposed to model my program in my head, there's so many parts
At least with math things made sense, and it felt good thinking about it.
>>
>>60816224
/dpt/ - Daily Pooinloo Thread
Pajeets in here share their poo
>>
>>60820508
What would you prefer then?
Channel *chan(val, val val) = (Channel*)malloc(sizeof(Channel));

Or
Channel *chan = ((Channel*)({val, val, val}));

I use new cause it makes cognitive sense. Its a NEW channel and a NEW protocol
The other two methods i know, as displayed above, seem needlessly arcane
>>
>>60820530
Define "big programs".
>>
>>60820530
Do some UML diagrams.
>>
>>60820530
Just write a program that does what's asked of it. No one expects you to be able to architect a big program straight out of college. You get put under another developer and you learn under them for a few years, then you take over.

And yes, define ``big program''. This is a common anxiety that sophomores and juniors have.
>>
>>60820530
There is no easy answer to that question. It's entirely dependent on the problem you're solving.

>>60820538
>UML
AHAHAHAHAHAHAHHAHHAHAHHA
>>
>>60820536
Something with more than 2000 lines.
Language is Common Lisp btw.
>>
File: VNKfI.png (294KB, 1534x855px) Image search: [Google]
VNKfI.png
294KB, 1534x855px
>>60820520
You should use either `make_unique` or `make_shared` instead, but mostly the former. But anyway, I recommend watching his presentation at C++Con from a year or two ago
>>
File: 1492783618248.png (3MB, 2160x2160px) Image search: [Google]
1492783618248.png
3MB, 2160x2160px
>>60820538
>UML
>>
>>60820538
don't stay up too late
>>
>>60820532
auto chan = std::make_unique<Channel>(80, "ABC", 0);

This way it's practically impossible to leak or to double free it.
>>
>>60820551
Sometimes I wish I knew what the hell he was talking about. I feel like I know C++ but whenever I watch Herb Sutter talk I feel like I don't know jack shit.
>>
File: vomit.jpg (90KB, 650x650px) Image search: [Google]
vomit.jpg
90KB, 650x650px
>>60820564
>>
>>60820493

I see that a objdump -d indeed places them correctly in the stack.Why does the asm generated by gcc not place them correctly?

727: c7 45 f0 02 00 00 00 movl $0x2,-0x10(%rbp)
72e: c7 45 f4 03 00 00 00 movl $0x3,-0xc(%rbp)
>>
>>60820567
Well you're just dumb then, he's presentations are very accessible, he's basically telling average C++ programmer how they should code.
>>60820573
Opinion discarded.
>>
>>60820545
>>60820553
If you don't understand the importance of UML, I recommend reading Systems Analysis and Design in a Changing World by John W. Satzinger.
>>
Shale oil to get chix
>>
>>60820581
>he's presentations
>you're just dumb
What did he mean by this?
>>
>>60820601
POO and UML are fucking garbage, anon.
>>
>>60820551
>that chart
Gonna have to agree with that other anon, shit's complicated compared to new and delete.
>>
File: what did she mean by this.webm (195KB, 1920x1080px) Image search: [Google]
what did she mean by this.webm
195KB, 1920x1080px
>>60820601
>the importance of UML
>>
>>60820530
modularize your code idiot

you don't need to worry about the rubber composition of your car tires when you're working on the engine
>>
>>60820564
Sure, that does add memory safety...
OR we can just teach people not to do stupid shit

Sure, with unique_ptr i cant double free shit
But are you seriously telling me that it's such a fucking godsend that it beats lessening the cognitive strain on anyone reading the code?

Looping, when you know how your structures behave, practically guarantees that shit works out
Especially when there's no input
for(int i = net->get_channel_count()-1; i >= 0; i--) {
delete net->get_channel_at(i);
}
delete open; delete msg; delete close;
delete net;
>>
>>60820665
>trusting people not to do stupid shit
Handrails were invented because we couldn't trust people to not trip on their own feet while going down the stairs.
>>
>>60820677
Stairs can be mighty dangerous, anon.
>>
>>60820493
>>60820579

anyone can answer please?
>>
>>60820551
>C++14
expecting everyone to use anything beyond C++11 right now is pretty silly
>>
>>60820680
So can double freeing a pointer
>>
>>60820665
If any of that throws an exception, none of your subsequent deletes are going to happen.
>>
>>60820315
If you work on a team with more than 5 people, you need objects. Else you will end up dividing territory and every person on the team will need to be the one to fix problems and expand in his own territory, because nobody else has any idea what the fuck is going on.

Using objects and making APIs is the best way to scale up a project for a big crew, and ensure that you can add new people to it without a six months learning period.
>>
>>60820623
What do you mean? Object oriented design is the foundation of modern software engineering.
>>
New thread:
>>60820727
>>60820727
>>60820727
>>
>>60820718
Go home, Rahul.
>>
>>60820692
That would be a legitimate concern if two conditions were to be met:

1) Someone using the code does something really fucking stupid that causes an exception on deletion (Freeing would be just as prone to this, y'know. As would probably unique_ptr but I've never used it, so couldn't say.), in which case said retard should never have been lurking in my code in the first place (Honestly, sending and receiving have failsafes, im not a fucking moron)

2) For some reason eof cleanup and process termination dosent kick in at all. In this case there's nothing i can do, sure, but thats hardly a concern
>>
>>60820393
>Why are you so fixated on FP? I only mentioned FP because it's the most popular paradigm that is not imperative or OOP. Jesus, think outside the box a little.
No that's not what happened anon.
>90% of the codemonkey jobs people wind up in would never use it.
This is not the way you present what you think is a "popular paradigm".
>>
>>60820482
>low contrast colorscheme
Enjoy your eyecacner
>>
>>60821010
If your colorscheme has any pure colors in it, then say goodbye to your eyesight.
>>
>>60820545
>>60820553
Brainlets who never designed complex systems before
>>
>>60820482
the grey text looks like shit and there are too many different colors. make the comments grey and get rid of the red and i have no idea why you have green sprinkled on all the punctuation and arrows
Thread posts: 328
Thread images: 23


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