[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 20
File: freebsdwoman.jpg (29 KB, 560x293) Image search: [Google]
freebsdwoman.jpg
29 KB, 560x293
No discrimination edition

Old: >>52269646
>>
gay
>>
File: 299845771d4270284_w.jpg (36 KB, 600x337) Image search: [Google]
299845771d4270284_w.jpg
36 KB, 600x337
How do I make an ABI
>>
File: B4Bz-wHCcAEfZYq.png (376 KB, 600x365) Image search: [Google]
B4Bz-wHCcAEfZYq.png
376 KB, 600x365
>>52274940
does anyone still take this bitch seriously anymore?
She's burning down all her bridges.
also
>still caring about gaymergate in 2016
https://github.com/freebsdgirl/ggautoblocker
>>
>>52274803
That's worst case, which would be incredibly rare. Often realloc just reuses the same memory block without copying. Best case it's much faster than a linked list, both O(1) but mine doesn't have the overhead of malloc.
>>
>>52274940
First for being third
>>
>>52275115
Have you ever created a github repo that has been starred 333 times?
>>
>>52275155
I'd rather have zero stars than the attention of neurotic women and male feminists.
>>
>>52275115
>https://github.com/freebsdgirl/ggautoblocker
I couldn't find
cout << "Block." << endl;

anywhere.
brianna must not contribute :(
>>
>>52275052
By writing a compiler or using compiler directives that stop it from moving things around in memory.
>>
What is the more pythonic way to do this
for i in range(0, len(correct_file_lines)):
incorrect_count+=1 if base_file_lines[i] == comparison_file_lines[i] else pass
>>
>>52275115
Only gamergate cares about her.
>>
open BL, '>block_ids.txt' or die "Can't open block_ids.txt: $!\n";

This woman is a shit perl scripter and a shit person.
>>
>>52275115

I don't even know who that is cause I'm not a "gaymer"
>>
>>52275155
I have 10 stars on a very niche library that I don't advertise outside of a forum signature.
>>
Threadly reminder that you should not refer to the act of programming as coding. It is improper and makes you look like a 16 year old

You are a programmer, not a coder

Software Alchemist is GOAT
Developer is okay
Magician is okay
Software Magus is okay
Software Engineer is okay
Software Architect is okay
Code Guru is okay


Archmage is reserved for only the most senior of programmers

Writing in HTML and CSS is not programming, therefore it should be refered to as designing
>>
>>52275352
>Software Engineer is okay
Software Engineers are code monkeys and they're not real engineers. Just ask /sci/ if you don't believe me.
>>
>>52275352
STFU
>>
>>52275352
What does 'keyboard raper' make me?
>>
>>52275297
forget about that pass else
>>
>>52275359
No, Software Engineers are proper engineers, assuming they follow actual software engineering processes.

>/sci/
lmao
>>
I really like the way you add new games to Aisleriot Solitaire

https://git.gnome.org/browse/aisleriot/tree/games/klondike.scm
>>
>>52275302
the freebsd people better start doing something about her because she's fucking them over
>>
File: uui9.png (481 KB, 626x988) Image search: [Google]
uui9.png
481 KB, 626x988
How do I learn to code in JavaScript, /dpt/?
>>
>>52275297
I'm never in DPTs - is this bait?
>>
>>52275384
Thats some circular logic right there..
>>
>>52275000
thanks anon. I like programming, it's just that it's hard to keep up on it on my free time while simultaneously having to keep up with other courses that sadly have nothing to do with programming.

I do remember the basic stuff, but it was all in Java, I think the real problem I'm having is translating it to C. A day or two of reviewing and I should be good to go.
>>
>>52275414
JavaScript doesn't belong here.
>>52229559
>>
>>52275155
4755 stars and counting.
>>
>>52275440
Nobody cares about your gay forced /wdg/ thread, anon.

Why are you still posting them?
>>
>>52275440
If you think Javascript is not a programming language, here's where you should be:

>>>/b/
>>
alright boys, found our new CoC
https://github.com/oapi/shieldsup/blob/master/CODE_OF_CONDUCT.md

She also has KFC on her whitelist.
l m b o
>>
>>52275427
yes ignore pyshitters
>>
>>52275455
>>52275474
Keep your web development bullshit in your bullshit general. JavaScript and anything related to it like node.js is cancer.
>>
>>52275115
https://twitter.com/randileeharper/status/684469940603060224
>>
>>52275455
>using gay as an insult
There's nothing wrong with being gay, you shouldn't use gay as an insult.
>>
File: HarperMugshot.jpg (97 KB, 990x675) Image search: [Google]
HarperMugshot.jpg
97 KB, 990x675
>>52275480
>randi "meritocracy offends me" harper
lol anon
>>
File: vvv.jpg (178 KB, 700x391) Image search: [Google]
vvv.jpg
178 KB, 700x391
>>52275507
Well, I think programming languages that are used on the web are programming.

Where do we go from here, anon? I'm not going to stop asking web programming related questions on /dpt/ and your complaining certainly isn't programming related.

It always seems to be one autist (see mirror) complaining.
>>
File: mons.webm (3 MB, 900x506) Image search: [Google]
mons.webm
3 MB, 900x506
Ask your very beloved programming literate anything.
>>
>>52275518
Don't worry man. I took it upon myself to provide an updated CoC for /dpt/.
As contributors and maintainers of this shitpost general, we pledge to respect all white people who shitpost through everything, including posting C code requests, updating their resumes, submitting a dog picture or multiple dog pictures, and other activities up to and not limited to posting dogs.

We are committed to making participation in this thread a harassment-full experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation especially if you're a faggot (this includes trap posters), disability, personal appearance, body size, race (niggers mostly), ethnicity, age, or religion.

Examples of acceptable behavior by participants include the use of sexual language or imagery, truthful derogatory comments or personal attacks, trolling, public or private harassment, insults, or other professional conduct.

Project maintainers have the right and responsibility to give absolutely no fucks. Contributions are not aligned to this Code of Conduct as their gravitational pull is too strong. Project maintainers who do not follow the Code of Conduct may be fluffed in the back for a small fee.

This code of conduct applies both within your fat rolls and in public spaces on the rough exterior which is your face, when an individual is representing the project or its community.

Instances of abusive, harassing, or otherwise acceptable behavior may be recorded for quality control purposes.

This Code of Conduct is adapted from the from fat whiney bitch who should have just shut off the computer because the internet is too big and scary even for her epic girth.
Source: https://github.com/freebsdgirl
>>
>>52275440

What language do you think 4chan was written in? Haskell?
>>
>>52275572
>Well, I think programming languages that are used on the web are programming.

Kinda... But they're so easy to work with, they're not very welcome here. Gonna call you a n00b.
>>
Threadly reminder that:

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
>>
>>52275577
Why don't you have a job yet?
>>
>>52275612
Asperger
>>
>>52275577
That's lewd
>>
>>52275596
>code
I would prefer it if you used the word program
>>
>>52275631
Sorry
[word]As contributors and maintainers of this shitpost general, we pledge to respect all white people who shitpost through everything, including posting C code requests, updating their resumes, submitting a dog picture or multiple dog pictures, and other activities up to and not limited to posting dogs.

We are committed to making participation in this thread a harassment-full experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation especially if you're a faggot (this includes trap posters), disability, personal appearance, body size, race (niggers mostly), ethnicity, age, or religion.

Examples of acceptable behavior by participants include the use of sexual language or imagery, truthful derogatory comments or personal attacks, trolling, public or private harassment, insults, or other professional conduct.

Project maintainers have the right and responsibility to give absolutely no fucks. Contributions are not aligned to this Code of Conduct as their gravitational pull is too strong. Project maintainers who do not follow the Code of Conduct may be fluffed in the back for a small fee.

This code of conduct applies both within your fat rolls and in public spaces on the rough exterior which is your face, when an individual is representing the project or its community.

Instances of abusive, harassing, or otherwise acceptable behavior may be recorded for quality control purposes.

This Code of Conduct is adapted from the fat whiney bitch who should have just shut off the computer because the internet is too big and scary even for her epic girth.
Source: https://github.com/freebsdgirl[/word]
>>
>>52275507
No. Javascript is a proper programming language. If someone wants to discuss it here they're welcome to do so. You might like it more or less but we don't care.
>>
Daily reminder that if you don't output significant code and programs regularly you don't have the right to call yourself a programmer.
>>
File: 8u.jpg (50 KB, 640x360) Image search: [Google]
8u.jpg
50 KB, 640x360
>>52275650
I think the best course of action is just to ignore people who complain, anon.
>>
>>52275124
I think you're missing the point. A vector with geometric (constant-ratio) resizing has "amortized O(1)" appends.

Even if every reallocation requires copying the previous elements, N/2+N/4+N/8+...=N and N+N/2+N/4+N/8+...=2*N. In the worst case (where it needs to resize to fit the very last element), you do 2*N-1 copies for N+1 appends (i.e. two copies per append), In the best case (where you just manage to fit the last element before a resize would be needed), it's N-1 copies for N appends.

If realloc() manages to extend a block and avoid the copy, that's a bonus.

You don't choose linked list over vector based upon average append performance; even if a linked list wins, it won't win by enough to beat the read performance of a vector.

If you choose a linked list, it's either because it has O(1) insertion, or because enlargement (insert or append) doesn't invalidate pointers into the list, or because you need "real" O(1) appends rather than amortized O(1) appends (i.e. choosing latency over throughput), or because you can't get contiguous memory, or because a vector isn't an option (e.g. order-independent transparency on a GPU uses linked lists of fragments because the architecture isn't amenable to implementing a heap).
>>
>>52275649
[word]As contributors and maintainers of this shitpost general, we pledge to respect all white people who shitpost through everything, including posting C program requests, updating their resumes, submitting a dog picture or multiple dog pictures, and other activities up to and not limited to posting dogs.

We are committed to making participation in this thread a harassment-full experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation especially if you're a faggot (this includes trap posters), disability, personal appearance, body size, race (niggers mostly), ethnicity, age, or religion.

Examples of acceptable behavior by participants include the use of sexual language or imagery, truthful derogatory comments or personal attacks, trolling, public or private harassment, insults, or other professional conduct.

Project maintainers have the right and responsibility to give absolutely no fucks. Contributions are not aligned to this program of Conduct as their gravitational pull is too strong. Project maintainers who do not follow the program of Conduct may be fluffed in the back for a small fee.

This program of conduct applies both within your fat rolls and in public spaces on the rough exterior which is your face, when an individual is representing the project or its community.

Instances of abusive, harassing, or otherwise acceptable behavior may be recorded for quality control purposes.

This program of Conduct is adapted from the fat whiney bitch who should have just shut off the computer because the internet is too big and scary even for her epic girth.
Source: https://github.com/freebsdgirl[/word]


Fixed
>>
>>52275680
This, javascript is a professional language that makes dinosaur languages like C obsolete.
>>
>>52275689
hm, well done; nice contribution to the thread indeed.
>>
>>52275706
Which language are JavaScript interpreters usually written in?
>>
>>52275730
Who cares, C is obsolete.
>>
File: trew.jpg (116 KB, 1280x720) Image search: [Google]
trew.jpg
116 KB, 1280x720
I think we should ignore people who say X is better than Y too.
>>
>>52275518
What was she arrested for?
>>
>>52275730
You responded to a shitposter.

I'm shaking my head at you right now, anon. You gave him what he wanted.
>>
>>52275730
javascript desu
>>
>>52275748
X has 4 lines of symmetry, Y does not.
>>
>>52275764
>people who like what I don't like or don't like what I like is a shitposter
Seriously, nobody uses or recommends C these days.
>>
>>52275352
Coding sounds cooler and less nerdy than programming.

If you ever want a chance at getting your dick within the orbital pull of a vagina, call yourself a coder or even a hacker.
>>
@52275790
I'm not giving you a (You), anon.
>>
>>52275297
You could make it a one-line comprehension instead of a for-loop.
>>
>>52275832
Then why are there more JavaScript programmers than C programmers?
>>
>>52275215
># this would probably be better off stored in a hash whose values are monitored by
># this program so we didn't have to make this call so often, but whatever.
Aka, I'm lazy.
>>
>>52275847
Because there're more dumb people than smart people on the planet.
>>
>>52275730
Machine code.
>>
>>52275758
Failing to show up to court, apparently.
>>
>>52275863
I love perl, and reading her code makes me want to puke, re-eat it, and puke it right back up onto printed off sheets of non-recycled paper.
>>
>>52275876
Well more people are using JS and it powers the web, they sound pretty smart to me.
>>
>>52275832
>@
go back to twitter
>>
>>52275876
C is actually pretty easy, even dumb people can use it without a problem. In fact C is what my university used to teach programming 101 a few years ago.
>>
>>52275876
>le c programmers are smart may may
>>
File: a ruff victory.jpg (65 KB, 500x368) Image search: [Google]
a ruff victory.jpg
65 KB, 500x368
>>52275880
The ass imprint in her chair was too deep l m a o
>>
>>52274731
Fixed this a while ago, just saw your post. Thanks to >>52272944 I found out that the problem was evidently in my carry function.

The actual solution is 1366, and the problem was that if an arbitrary digit 'x' was over 10, I was setting 'x' to 'x % 10' and THEN setting the next one to 'x / 10'. Obviously, since I modified 'x' in the previous step, 'x / 10' is always and carry pretty much meant that I never got beyond a single digit.

Once I realized, I made a copy of the digit first, then used that copy to calculate the carry as 'copy / 10', and then the program gave me the correct answer instantaneously.

>>52274977
The first language I was taught was FORTRAN. I'm a geophysics major, and in my second year we had numerical analysis (studying for the final now, basically). FORTRAN isn't very feature rich, but holy shit can it crunch numbers, and in my major that's what you'll need most of the time, so that's what they teach.

In a class that covers GIS and everything related, we were taught Octave for it. Octave felt way, way too... loose. It didn't have that rigidity that FORTRAN did, and honestly I didn't like that. Python is even worse in this regard, I tried doing a couple basic things with it but I hated it.

Of course I wanted to pick up something more general than FORTRAN, and the best looking thing I saw was C. Sure, by modern standards it's low-level as fuck (though the professor for numerical analysis would refer to FORTRAN as high level, the fagot actually knows x86 asm pretty well, and even did z80 and Motorola asm back in the day). So far, I'm liking it better than FORTRAN, and Euler is just a way of basically forcing myself to learn it. Except when I see a problem I can easily do in FORTRAN, in which case I do.

Thinking of picking up a microcontroller and doing random shit once I git gud with C, but I haven't been arsed enough to even bother learning how to read/write data from/to a fucking file yet, or how to utilize pointers in C.
>>
>>52275943
I like to imagine you calming saying all the shit in your post I didn't read, but when saying FORTRAN you yell it really loud.
>>
>>52275891
I loved getting to the bottom and finding

># TODO: actually block the user!

Doesn't that mean this script isn't even doing what it was made for? It's apparently been forked 80 times and it doesn't even work.
>>
>>52275897
The web is powered by C. Interpreters are written in C, kernels are written in C, etc...
JS is only used to glue shit together.
>>
>>52275847
because JavaScript and C work on completely different fields
>>
>>52275943
>>52275962
FORTRAN
https://www.youtube.com/watch?v=UIxsP3lJjuE
>>
>>52275975
And it's extremely important for the web unless you love ugly worthless static pages that don't do anything.
>>
>>52275943
> 'x / 10' is always and
*is always 0

>Sure, by modern standards it's low-level as fuck
*but I'm not interested in anything higher-level than number crunching to begin with.
>>
File: iuy.jpg (38 KB, 534x526) Image search: [Google]
iuy.jpg
38 KB, 534x526
Just went outside and asked the first cute girl I found if she'd like to be my gf.

She called me a creep and told me to get away from her.
>>
>>52275996
>Just went outside
Well this post is bullshit already.
>>
>>52275996
It's okay anon, you're already doing better than most of us
>>
>>52275996
That only works if you're a chad and you don't directly ask her, you act like you give a shit about what she has to say, gain her trust before asking.
>>
>>52275993
I'd rather have static pages that actually scale on mobile devices than some JQueer monstrosity. If you think design > functionality, please go away.
>>
>>52276031
Yes, design is very important. Like I need some stupid autist who wants the web to look like it's the early 90s to tell me what to do.
>>
>>52276031
Time to upgrade your dumbphone, Rajhesh.
>>
>>52275962
kek
I thought it was all caps, and it fucking was, but apparently they changed it years ago. I got most of my info from a textbook from the 70's, so you'll have to forgive me for not realizing that they changed it in the 90's.

>>52275996
>asked
>having the minimal courage to even be able to ask
[REEEEE intensifies]
>>
why do anonymous functions in python suck
>>
Doing a simple C++ program for league that randomizes a role, lane, and champion for you. Link here: https://ideone.com/54YKDT .

Anyway, I want to be able to ask the user for how many options generated at once, because people queue up with others. So how do I allow the program to generate up to 5 roles at once, and none of them have the same lane or champion? The role can be the same, but I want to generate a unique integer for the lane and champion to be different for the 5 outputs. How do I do this?
>>
>>52276057
Design is the least important. Make it work is the highest priority. Masturbating about a fucking font and the color palette is for stupid folk like you.
>>52276077
Joke's on you. Got a 6P 128GB for free.
>>
>>52276088
Being able to talk to a girl isn't hard, but dealing with them is. 3DPD are stupid and annoying and I'm glad I don't care about them.
>>
File: kissu.webm (3 MB, 1920x1080) Image search: [Google]
kissu.webm
3 MB, 1920x1080
What books does /dpt/ recommend?
>>
File: TGryqMH.png (824 KB, 500x1725) Image search: [Google]
TGryqMH.png
824 KB, 500x1725
Quick /g/! Make a program than can upload a text file to pastebin.com.
>>
>>52276164
That was kinda gross desu
>>
>>52275943
If you want to crunch numbers but like Python, Julia is statically typed but its concise like Python

>>52275427
incorrect = sum([1 for i in zip(lines,other_lines) if i[0] != i[-1]])
>>
>>52276164
So sexy.
>>
>>52276165
why?
cat whatever.c | nc termbin.com 9999
http://www.termbin.com/randomletters/numbers

DONE.
>>
>>52276176
I'm with you sempai.
>>
>>52276164
http://web.mit.edu/alexmv/6.037/sicp.pdf

http://www.ime.usp.br/~pf/Kernighan-Ritchie/C-Programming-Ebook.pdf

http://cdn.oreillystatic.com/oreilly/booksamplers/9781491903896_sampler.pdf

http://haris-krajina.rhcloud.com/wp-content/uploads/2013/01/baba.pdf

http://djm.cc/library/Calculus_Made_Easy_Thompson.pdf

https://g.sicp.me/books/
>>
>>52276176
agreed, 3D females are gross.
>>
>>52275673

Define "significant" code
>>
>>52276164
>tfw your girlfriend is Caucasian
>>
>>52276181
Actually I like this one better
incorrect = len(filter(lambda x: x[0] != x[1],zip(lines,other_lines)))
>>
>>52276273
Just break up with her already.
>>
>>52276258
Bait.
>>
>>52276273
It could be worse, anon.

She could always be, I don't want to say it because I don't want to be racist, but you know what I'm thinking.
>>
>>52276350
Please refer to >>52275689 and don't make me report you.
>>
>>52276350
Yeah, she could be Latino
>>
>>52276302
Not the "pythonic" way to do it though
>>
File: sql.jpg (89 KB, 839x581) Image search: [Google]
sql.jpg
89 KB, 839x581
How do I do this in MS SQL?
>>
>>52276176
agreed. All the bacteria, sweat, hair and puss on that bag of skin.

Cartoon waifu's 4 life
>>
File: trap programmer.png (1 MB, 1702x2471) Image search: [Google]
trap programmer.png
1 MB, 1702x2471
Daily reminder that if you don't program while dressed like a schoolgirl, you don't belong on /dpt/.

You can redeem yourself by buying a schoolgirl outfit and the C Primer Plus (6th Edition) by Stephen Prata, preferably in the same cart.
>>
>>52276399
Pay attention is class.
>>
>>52276406
>>52276405
Off yourselves.
>>
Reminder that something that takes 7 hours in Python literally takes < 1s in C
>>
>>52276430
>inb4 hurr hurr yeah but the development time is reversed
fuck u pithawn fags
>>
>>52276420
It's a hackerrank problem, I'm already in work but any sql queries are either simple or the sql expert deals with it
>>
>>52276430
Is python really that slow?
i tried md5 bruteforcing in bash and it never completed after 18 hours.
meanwhile, my c solution took only a few minutes.
>>
Reminder that something that takes 7 hours to develop in C takes < 1s to develop in Python
>>
>>52276465
see >>52276449
also
"import".
Man you're such a good programmer.
>>
>>52276454
Literally happened yesterday, Python kiddie's program takes 7 hours to run, Java solution takes < 5 minutes and C/++ takes <1s
>>
>>52276406
Is C Primer Plus a good book or is this just bait?
>>
>>52276476
I read it and it contained no useful information

And I don't see how repeatedly reinventing the wheel is good programming practice
>>
>>52276484
post code again? sounds interesting
>>
>>52276430
import time
time.sleep(60*7)
>>
>>52276511
DUDE WEED
>>
>>52276511
wew
>>
>>52276495
It's very long, but it's pretty complete as far as C tutorials go.
>>
>>52276127
Oh, talking isn't a problem at all. It's trying to get your intentions across without being a put-her-on-a-pedestal-and-hope-she-notices fedora nor going "Hi, what's up? So, look, want to fuck?"
>>
>>52276127

Those are some deep issues you're projecting.

Your anime pillow isn't a real person.
>>
>>52276556
>Oh, talking isn't a problem at all.
speak for yourself normie
>>
>>52276382
Buts it cleaner,more concise and easy to read. Thats exactly what python stands for. Its should be bonus points because it is also a pure function
>>
>>52276556
Yeah, it's called having social awareness.
Also try to put yourself in their shoes.
Oh wait, you have assburgers, nevermind.
>>
>>52276127
You are stupid and annoying, please leave.
>>
>>52276658
roastie detected
>>
>>52276621
And you're doing what to fix this problem? Oh, shitposting and watching anime? Good job. You have no reason to complain, faggot.
>>
>>52275508
>>52274940
>>52275518

https://np.reddit.com/r/PHP/comments/3zhapd/rfc_adopt_code_of_conduct/
>>
How does it feel knowing that I purposely insert sleep() functions all over my code to slow it down and make it seem like my program is more substantial and hard working?
>>
>>52276671
>And you're doing what to fix this problem?
not trying to fix it much anymore. Tried for years, but I've lost most hope at this point. I just fantasise about suicide most days now.
>>
>>52276695
absolute madman
>>
>>52276671

It's much easier for him to invent an imaginary friend than to work on his communication skills.
>>
>>52276718
You don't need friends, you only need yourself.
>>
>>52276739

Mammals are social creatures.
>>
Noob here, trying to make a C sumThroughIteration function (example: if n=5, it should return 5+4+3+2+1=15. I declare it and print it but nothing happens. Here's the code, please explain what I've done wrong. It's part of a larger program but I'll only paste what's relevant.
#include <stdio.h>

int sumThroughIteration(int n);

int main()
{
int n;
scanf("%d", &n);
printf("%d", sumThroughIteration(n);
return 0;
}

int sumThroughIteration(int n)
{
int sum = 0;
for(;n>0;n--)
{
sum = sum + n;
}
/*also tried printing sum on this line*/
return sum;
}
>>
I want a boyfriend ;_;
>>
>>52276844
Camel case is disgusting in C.
>>
Why cant you declare a type as implementing two interfaces in OOP?
Printable, Readable a = new...
a.print();
a.read();
>>
>>52276858
;_; please respond
>>
>>52276944
Remove your awful capitalization. Respect C naming convention and I will help you.
>>
>>52276922
You can, it's called parametric polymorphism.
>>
>>52275909
This I learned C on my own in middle school
>>
>>52276922
You can do that in anything that has row polymorphism instead of subtyping (e.g. OCaml).
>>
>>52276809
so? I don't want to socialize with people.
>>
>>52276989
>implying OCaml hasn't subtyping.
>>
>>52276992
Then why are you here socializing right now?
>>
>>52277020
It doesn't, it has row polymorphism. To the same end, of course, but row polymorphism works well with type inference while subtyping does not.
>>
>>52276974
>interfaces
>parametric polymorphism
Sorry, son, but you'll have to repeat that class.
>>
In python, if I have a dictionary mapping strings to lists, how do I access one element of the list given an index and the string key?

is it just dict_name[key][index]?
>>
>>52277049
What is the O in OCaml?
>>
>>52277034
1s and 0s are not people
>>
>>52277066
Row polymorphism accomplishes the same thing as subtyping.
>>
#include <stdio.h>

int sum_through_iteration(int n);

int main() {
int n;
scanf("%d", &n);
printf("%d", sum_through_iteration(n);
return 0;
}

int sum_through_iteration(int n) {
int sum = 0;
for(;n>0;n--) {

sum = sum + n;
}
/*also tried printing sum on this line*/
return sum;
}

>>52276957
I'm desperate you see. I tried googling similar examples but didn't find anything.
>>
>>52277052
Excuse me?
>>
>>52275508
whoa, 4chanx can embed tweets

neat.
>>
>>52276164
CLRS
Algorithm Design Manual
SICP
K&R
AI: A Modern Approach
Real World Haskell
Pinter: A Book of Abstract Algebra
Wasserman: All of Statistics
Some Chinese Guy: Principles and Techniques of Combinatorics
Strang: Linear Algebra and its Applications
Bondy and Murty: Graph Theory

Some of my favorites :3
>>
>>52275790

Dumbest thing I've ever read on /g.
>>
>>52277062
list = dict_name[key]
x = list[index]


Now combine them, and what do you get?
>>
>>52277074
That's not what your subconscious mammal brain thinks.
>>
>>52277091
The underscores are awful but you made an effort. So I will help you.

printf ("%d\r\n", sum_through_iteration(n));


You must add the new line characters to force the flush of the buffer.
>>
>>52275352
>Software Alchemist
thanks for the new title, famarino
>>
File: 1434619326362.jpg (107 KB, 1116x714) Image search: [Google]
1434619326362.jpg
107 KB, 1116x714
>>52277137
>>52277122
t-thanks

im pretty stupid when it comes to syntax and life
>>
https://youtu.be/-5Epb5Fisio lmao
>>
>>52277159
This isn't a syntax problem, it's a fundamental understanding problem.
>>
>>52277091

Change it back to camelcase, and don't listen to this prick.
>>
>>52275606
I want pyshitters to leave
>>
>>52277167
ive only ever coded mips in my life, trying other stuff out now, s-sorry senpai
>>
>>52277127
You're just jealous that C is being replaced by languages like JavaScript. JavaScript is a real language and if you can't accept that, leave.
>>
>>52277145
Thanks. What's a better alternative, sumthroughiteration?

Also, trying do something like temp = sum_through_iteration and then printing temp doesn't work either.
>>
>>52275847
If that isn't enough, how about goto fail? All the IIS exploits in v4/5? Various Windows RPC overflows, WMF overflows, SQL Slammer, et al? How many billions in damages caused by stack smashing and buffer overflows? How many millions of hours of manpower wasted cleaning up after these errors? Toyota killed some people because their dumb code overwrote memory, blasting the OS task tables causing the watchdog task to stop getting CPU time, meaning nothing provided a stopgap against unintended acceleration. People are literally dying because we can't let go of C.

C is like saying "forget seat belts, child seats, anti-lock breaks, and adaptive steering! How can I power-slide? I want full control; I need to pump the breaks. People should just drive better, then we'd have fewer accidents".

We've been trying to "drive better" for decades (Valgrind, lint, code reviews, static analysis tools, education, ASLR, NX protection, et al). We still regularly see massive security-smashing epic failures.

It hasn't worked. Furthermore the C standard library has been proven turing-complete for ROP gadgets in the presence of a buffer overflow. So no matter what you do, the presence of a single stack smash is enough to allow code execution, subject to payload size limits and execution time.

At some point we have to admit C is no longer acceptable. Not for libraries, not for drivers, not for operating systems. It has to go.

All the performance benefits ever derived from writing everything in C has been more than erased, by orders of magnitude, by the damage caused from even simple innocent mistakes.

Software allows us as programmers to greatly magnify our impact on the world; we like to think of that in positive ways. But the inverse is also true: thanks to the continued use of non-memory-safe languages we have the power to negatively affect the world on a massive scale.

It is unethical to continue writing code in non-memory-safe C or C-based languages, for any purpose.
>>
>>52277212
>sumthroughiteration
Yes. That's the standard C naming convention.
>>
>>52275790
>>52277207
>Seriously, nobody uses or recommends C these days.
This is the most retarded think I have read all day. Oh, everyone, except for those who:
>programmed every single electronic / gadget in your house
>and the OS you use
>need to fit strict performance / size goals.
>and anyone learning programming in college.
>>
>>52277270
read this
>>52277242
C needs to die you dumbass fag
>>
im wondering how to implement ongoing animations that will stop and display a menu when input is detected, like a tamagotchi. c++ only.

i could have two threads, one soley to detect cin, but i get the idea that isnt the greatest solution.
>>
>>52277270
The only people I see recommending C nowadays are elitist hipster fags on /dpt/ who have contributed nothing
>>
>>52277207

I write plenty of JavaScript. But almost every single computer application you can think of is quite literally underwritten by C. Including every JavaScript interpreter/engine you can name, and the ones you can't.
>>
>>52277280
C is a hard, old language but you can't just kill it. There is literally hundreds of thousands of codebases and projects that depend on it. You can't just replace C magically with Rust or something else.
>>
>>52277242
I really, really like this copypasta. Mind if I save it?
>>
Rate my stack implementation
Stack *stack_new()
{
Stack *stack = (Stack*)calloc(1, sizeof(Stack));
stack->capacity = STACK_MAX; // max size is 100
stack->data = malloc(sizeof(void *) * stack->capacity);
stack->size = 0;
return stack;
}

void stack_delete(Stack *stack)
{
// free yourself
free(stack->data);
free(stack);
}

bool stack_empty(Stack *s)
{
if (s->size == 0)
{
return true;
}
else
{
return false;
}
}

bool stack_full(Stack *s)
{
if (s->size == s->capacity)
{
return true;
}
else
{
return false;
}
}

void *stack_top(Stack *s)
{
if (stack_empty(s))
{
ERROR("Stack is Empty\n");
}
// Return the topmost element
return s->data[s->size - 1];
}

void stack_push(Stack *s, void *element)
{
// If the stack is full, we cannot push an element into it as there is no space for it.
if (stack_full(s))
{
ERROR("Stack is Full\n");
}
else
{
// Push an element on the top of it and increase its size by one
s->data[s->size++] = element;
}
return;
}

void stack_pop(Stack *s)
{
// If stack size is zero then it is empty. So we cannot pop
if (empty(s))
{
ERROR("Stack is Empty\n");
return;
}
// Removing an element is equivalent to reducing its size by one
else
{
s->size--;
}
return;
}

void stack_clear(Stack *s)
{
while (!empty(s))
{
pop_back(s);
}
return;
}

>>
>>52277242
It's easy to kill the wrong people with guns. Some bad people have killed good people with guns. We need to switch to NERF launchers. It is unethical to use guns.

>>52275650
Javascript is a language for making slow shit locally and taking away the most basic user freedoms with SAAS

Users of proprietary binaries have more freedom than web app users
>>
Some people like a tiny language like C instead of a giant, constantly changing behemoth like C++. It is not about elitism.

Some people just learned C first and don't want to unlearn what they know to apply it to C++, because literally everything is a bad practice.

Some people prefer a 5 liner verbose than what C++ offers in one line. It doesn't look beautiful, but it does seem easier to understand.
>>
>>52277339
>It is unethical to use guns.
You are correct because guns are not a tool, they are designed to kill.
>>
>>52277124
not op but thanks :)
>>
>>52277334
oops pop_back should be stack_pop in stack clear
>>
>>52277334
>
if (s->size == 0)
{
return true;
}
else
{
return false;
}
>>
>guns analogous to a programming language
where were you when /dpt/'s retardation reached critical levels?
>>
>>52277402
Error: tool not declared in this scoped
>>
>>52277402
>guns are not a tool, they are designed to kill.
That would make them a tool for killing anon.
>>
>>52277334
>Stack
>not struct stack
Disgusting.

>stack_empty
#define stack_empty(S) ((S)->size == 0)


Same for stack_full.

>stack_clear
s->size = 0;
>>
>>52277402
Whiny libtard, please leave.
>>
>>52275115
>https://twitter.com/randileeharper/status/684469940603060224
For a female that seems to hate men so much she seems awfully keen to discuss CoC at a lot on Twatter.
>>
>>52277420
>>52277399
I don"t see the issue
>>
>>52276844
You're missing a closing parenthesis for your printf statement. Otherwise, this works fine. Are you inputting a number?
>>
>>52277476
he's right though, you don't use guns for anything other than killing people, and maybe breaking locks, the latter of which is also ethically questionable depending on circumstance
>>
I think my Android app is ready for publishing, and the store listing is complete, I just need to upload the APK and make it live

I don't know what it is though but I can't do it, it just feels like I should still be working on it, it feels like it isn't ready but it is, I've used it and tested it many many times
>>
File: pepez.gif (70 KB, 500x446) Image search: [Google]
pepez.gif
70 KB, 500x446
>>52277476
>>52277454
>>52277444
Thanks for the (You)s faggots, I'm going to the bank to cash them right now
>>
>>52277497
>what is hunting
>what is target shooting
>>
>>52277503
you're a pussy harry
>>
>>52277490
You can do it in one line:
return s->size == 0;
>>
>>52277520
I know

Should I just do it? Yolo and all that
>>
>>52277471
using struct everywhere is ugly as fuck imo
>>
>>52277518
>killing things
>practicing to kill things
Guns have no purpose except for killing, admit it.
>>
>>52277496
Yeah, the closing parenthesis mistake isn't on the original program I just didn't copy it correctly. And I'm inputting a number.
>>
>>52277518
killing and training for killing, unless shooting targets is a hobby, in which case it's still barely a tool, especially since we're talking about in comparison to programming languages in professional environments
>>
>>52277532
I never said they weren't.
>>
Does anyone have a script that will notify me when there's >250 posts in a /dpt/ so can I make a new thread with a trap image?

Might be an interesting project
>>
>>52275440
Ever heard of node js?
>>
>>52277532
killing in the name of defending is quite different, now stop shitposting about guns in a programming thread
>>
>>52277497
People own guns for self defense from niggers and other criminals. Trump is going to take gun control away to stop the jews from destroying the white race.
>>
>>52277571
m8 I can do that in python in 2 seconds, but I'm not sharing with a trapfaggot
>>
>>52277537

See... And you listened to the prick telling you to change the names of your functions...

Why the fuck did he tell you to change the name of your functions, without explaining why it's good for you?
>>
>>52275603
Nobody gives a fuck what you think
>>
>>52277584
>self defense
aka instigating fear through threat of killing, you dumb retard why else would it be considered defense?
>>
>>52275440
>>52229559
>>
>>52276844
sum 1->n = n/2*(n-1)
>>
>>52277572

One of the best C++ projects in the last 10 years.
Now stfu.
>>
>>52277583
Hey, I was the one who was talking about C when somebody compared it to guns
>>
So I've been working on a bash script, don't currently need help with it but when I do where should I ask? /dpt/ /flt/ /sqt/ or maybe stackexchange?
>>
>>52277620
Javascript is a real language you tard. We should merge /dpt/ and /wdg/ and just let the web devs, HTML5 programmers and javascript programmers crash here.
>>
>>52277471
>Preprocessor
>>
>>52277631
>>52277631
stackexchange or an IRC channel on freenode. maybe /r/bash

anywhere but 4chan really
>>
>>52277636
>Javascript is a real language you tard
no shit sherlock
>>
>>52277660
thanks anon
>>
>>52277675
Then stop redirecting professional JS programmers to the /wdg/
>>
>>52277710
I won't
>>
>>52277334
Don't error, return error codes and have return values be passed by value into the functions.
>>
>>52277767
>passed by value
passed by reference*
The complete opposite thing. Goddamn me.
>>
File: 1451751832808.png (17 KB, 418x359) Image search: [Google]
1451751832808.png
17 KB, 418x359
>when someone considers themselves a serious programmer, but has not delved through all the fields of video game programming
>>
>>52277631
>stackexchange
No they suck there. The best are here.
>>
>>52277636

What you'll find, is that no one (who can program) is really bothered about about language A,B or C. We can have a perfectly good discussion about the likes of Lua, SQL, Python, C, whatever the fuck. The problem is your fanboyism. It doesn't belong in computing. Tbf to you though, there are many working in industry with language 'x' (JavaScript, Java, Python, whatever) with the same narrow minded attitude as you. A good programmer needs to be objective. You need to be clearer about why language A,B or C is cool, but should really make an effort to understand why language A,B or C might have an advantage over the one you jerk too. Thinking like that will help you no matter which language you happen to like.
>>
>>52277810

Kek
>>
I finished my intro to C++ class in Uni. What's a good practice project?
>>
>>52277896
neural networks
>>
WOO nearly done with the CSV provider. before I work on IO for it, is it bad to force users to link to an existing, stand-alone CSV library or is that fine? should I just bite the bullet and reimplement the whole library from scratch?
>>
>>52277962
What's in a CSV library besides String.split() and String.join() ?
>>
>>52277242
so many buzzwords in one post
>>
Post terminal greeting
function fish_greeting
set_color -o normal
echo " "
echo " ></> "
echo " ></> "
echo " ></> "
echo " "
end
>>
>>52277983
>hurrr giving names to unique exploits means they're buzzwords
Reexamine your life my family
>>
>>52277979
not awfully much, but this one provides an IO interface, pretty printers, switching between row vs. column oriented processing, and some conversion functions.
>>
>>52277979
Depends on what data structures you want to handle.
>>
Give me one reason why C# is bad that isn't cross-platform compatability (You don't write C# if you're not solely targeting Windows)
Thread replies: 255
Thread images: 20

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.