[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: 341
Thread images: 24

File: prog.jpg (105KB, 473x496px) Image search: [Google]
prog.jpg
105KB, 473x496px
Previous thread: >>61286610
What are you working on, /g/?
>>
>>61289173
Lisp is the most powerful programming language.
>>
FIRST FOR TRAPS!
>>
/g/, why aren't you using algebraic effects in C?

https://www.microsoft.com/en-us/research/publication/implementing-algebraic-effects-c/#
>>
File: netrunner.png (507KB, 750x537px) Image search: [Google]
netrunner.png
507KB, 750x537px
>>61289173
We are making a web browser! >>61288757

Come and join the team on irc.
>>
>>61289198
>join the mentally ill on irc
no thanks
>>
>>61289194
>>>/cm/
>>61289198
>>>/pol/
>>
>learn assembly they said
>it'll be fun they said
>segfault segfault segfault segfault segfault segfault segfault segfault
>>
>>61289210
t. nodev
>>
>>61289198
>not one actual commit
kek this is the power of /g/
>>
>>61289198
fuck off
>>
>>61289198
schway
>>
>>61289234
MAKE ME, FAGGOT!
>>
File: 13731446.jpg (16KB, 480x478px) Image search: [Google]
13731446.jpg
16KB, 480x478px
>>61289198
>fork link2
>A License
>And a fucking readme
>"We are making a web browser!"
>>
>>61289197
not portable
>>
>>61289289
>We describe a full implementation of algebraic effects and handlers as a
library in standard and portable C99
>standard and portable C99
>>
>>61289308
>C99
not portable
>>
>>61289308
>c99
>portable
>>
>>61289308
>C99
>portable
top fucking kek
>>
>>61289308
>c99
>>
>>61289331
>>61289332
>>61289334
>>61289381
stop using MSVC
>>
>>61289391
i can't they've glued me to the chair
>>
>>61289391
>https://www.microsoft.com/en-us/research/publication/implementing-algebraic-effects-c/
>portable C99
>stop using MSVC
wew laddie
>>
How can you trust Microsoft to anything right if they can't even support C which should be the easiest language to implement?
>>
>>61289391
>MSVC
It works perfectly.
>>
>>61289444
They do support C89.
>>
>>61289456
Not really. fopen and fclose are not totally supported, the current implementation is buggy.
>>
>>61289456
they don't support C
>>
>>61289216
Honestly I get more segfaults with C than assembly.
>>
>>61289485
C89 is the only C that matters
>>
>>61289484
>fopen and fclose are not totally supported
good. they shouldn't exist at all.
>>
Seeking advice. I'm working on a cli todo list application but need a way to delete entries from a text file. Would the easiest way to simply prompt the user to enter the full entry?
>>
>>61289604
Why?
>>
>>61289614
>he doesn't know
lol
>>
>>61289584
Are you single? Do you want to marry me?
>>
>>61289623
Ho now I see why I shouldn't use fopen and fclose. Thank for the enlightenment.
>>
C99 is BAD
>>
>>61289173
>a cli todo list application bu
BI on oracle
>>
>>61289658
>claims c99 is bad
>continues to program in nodejs and c++
dumb millenial.
>>
>>61289658
VLAs are not evil.
>>
File: 1482704825632.png (96KB, 400x400px) Image search: [Google]
1482704825632.png
96KB, 400x400px
>>61289666
>>
File: lmao.png (572KB, 600x580px) Image search: [Google]
lmao.png
572KB, 600x580px
>tfw you only release 64-bit binaries to piss off the dumb poorfags
>>
how do I go about understanding g++'s STL implementations. I read what en.cppreference.com has to say but it doesn't have much towards any actual implementations. I'm reading the code but good lord it's barely legible. I understand how to use the containers well already.

maybe I need to start with understanding STL iterator usage?

idk any help
>>
File: lmaoo.jpg (148KB, 1111x597px) Image search: [Google]
lmaoo.jpg
148KB, 1111x597px
>tfw they open an issue about it but you tell them to get a job and close it
>>
>>61289753
best not to ask
>>
>>61289753
STL in most implementations is impenetrable wizardry. Better not to peek under the hood.
>>
>>61289753
Write your version first and try to link your programs to it. You'll understand a lot.
>>
>>61289739
>>61289775
kek
>>
Learning programming here. What resources did you use to learn? What was the first project you made?
I have ideas, but once I begin I end up not knowing what I'm supposed to do and feel I'm getting ahead of myself.
>>
File: 234662345342353.gif (2MB, 350x253px) Image search: [Google]
234662345342353.gif
2MB, 350x253px
>>61289775
>>61289739
living the dream, anon
>>
>>61289234
no u
>>
>>61289847
a book and the langs docs
a shitty game
>>
#define or enum?
>>
>>61289878
How proficient would you say you are now?
>>
>>61289898
uninstall c
>>
>>61289898
enum
>>
>>61289777
>>61289786
>>61289790
what's the best way to write simple extensions to STL classes then, just inherit from them and write your function? do I need to make copy/move/destr all over again
>>
File: allseingeye.jpg (266KB, 1500x1000px) Image search: [Google]
allseingeye.jpg
266KB, 1500x1000px
A python web scrapper designed to find information on people using social media sites to prove a point to the mindless sheep that social media is dangerous and also to freak people out
>>
>>61289932
free functions
>>
>>61289958
need operator overloads tho
>>
>>61289902
Good enough to manage on my own.
If i ever finish the book id probably feel competent enough to apply for a wagie job.
>>
>>61289977
They can be free functions too.
>>
>>61289932
No write from scratch. Just bind yourself to posix.
>>
>online the easiest part is making a logo and no one wants to program
>in reality the programming is done and the logo is still just a blank document in illustrator
the temptation to just make it a dick is real
>>
reminder that if you release code under the GPL i am going to steal your code and put it in my proprietary software, and you will never know or be able to do anything about it
>>
>>61289985
Name of the book?
>>
>>61289998
http://ddili.org/ders/d.en/index.html
>>
there is literally nothing wrong with node.js
>>
>>61290023
Why would you put HTTP:// in the title of your book?
>>
>>61289997
jokes on you my code is shit
>>
>>61289997
oh hey i already do this
>>
>>61289998
It's the Go book:
https://www.golang-book.com

>>61290023
Imposter

>>61289997
Good for you
>>
>>61290066
Back to work Rob
>>
>>61289997
>not including botnet in all libraries you distribute
>>
>>61289997
Oh dang you got me what ever will I do, code I released to be shared has been... Shared.

Oh what a world.
>>
>>61290080
double the botnet double the fun
>>
>>61290087
GPL isn't about sharing, it's a viral license designed to restrict freedom.
>>
>>61290130
yes, GPL is about restricting you from taking my effort and using my code without giving credit or sharing back with my and your/my users
>>
>>61290158
I do it anyways qt
>>
WHY DID I LEARN C INSTEAD OF C++? FUCK I'M SO STUPID.
>>
>>61290158
too bad that doesn't stop me
>>
>>61290208
unlearn c and learn sepples now
>>
File: CLion .png (4KB, 293x141px) Image search: [Google]
CLion .png
4KB, 293x141px
Does anyone know how to get clion to actually show me the values in an array fashion when using pointers? Right now I only get the correct behavior for static arrays.

I don't see why it's giving me the wrong floating point values for when I cast it as a 3 slot array.
>>
>>61290208
Learn C++ now. You'd just fuck it up if you didn't know C.
>>
>>61290208
you have to learn C before learning C++, though. you don't need to, but it's the best way
>>
>>61290270
you wouldn't believe how many people would critize you for saying this
>>
/dpt/ should I go for Italian, Chinese, or Japanese food tonight?
>>
>>61289997
This is immoral and toxic behavior. I will kindly ask you to cease and desist in continuing this malicious act.
>>
>>61290280
I see where they're coming from, but they're wrong.
They want you to colour within the lines, do everything the new and safe way. That's fine to do in general, but it's incorrect for learning learn. As soon as you tread off the beaten path you're in unsafe C territory, and then you're totally fucked.
Not to mention the fact that you really won't understand what your code will compile down to.
>>
>>61290295
all garbage
>>
>>61290295
Chinese
>>
>>61290295
buy japanese ramen because us coders amirite? XD
>>
>C cucks are still using their cuck C89 in their cuck MSVC compiler
>Meanwhile I'm here using my comfy C++17
Lmao. Fucking blubs to the absolute max, they don't even use C11 like they should.
>>
long time;

hheheehehehehehe
>>
Why do so many people here shill C?
>>
>>61289777
>>61289786
No, it's not wizardry, it's just advanced C++.
You can learn it if you're not retarded.
>>
>>61290367
sucky-sucky fucky-fucky xD
>>
>>61290375
"Advanced C++" is retarded
Get a real type system
>>
>>61290399
name a POOlang with a better type system
>>
>>61290425
Why would you want a poolang?
What the fuck.
Scat isn't something to be proud of anon.
>>
>>61290425
see >>61290432
https://en.wikipedia.org/wiki/SCATSAT-1
>>
>>61290399
Go back to your playpen and let the grownups talk.
>>
why the fuck do i leak yellow liquid shit from my ass? this has been going on for several days now. my ass gets wet overnight. when i try to wipe it thoroughly, my ass gets wet again soon after.
>>
>>61290446
I bet you think templates are smart
>>
>>61290467
Anal leakage. Consult a doctor.
>>
>>61290467
don't eat shit
>>
what is the output?

template<typename T>
int foo(T t) { return 1; }
int foo(int i) { return 0; }

int a(2)
foo(a); //which is called?
>>
>>61290506
the more specialized one, foo(int)
>>
>>61290467
doctor fag here, its aids
>>
http://en.cppreference.com/w/cpp/language/function_template#Function_template_overloading
>>
>>61290467
google it. then >>61290475 asap
I hope you don't have rectal cancer or some other, grave illness, anon. good luck.
>>
What is the best IDE for C? I usually use a simple text editor, but I'm looking something with project management tools and git integration.
>>
>>61290609
vim
>>
>>61290576
>google
enjoy your botnet
>>
i'm fucking suffering

my brain cell can't handle this apparently

Code Abbey problem 23: http://www.codeabbey.com/index/task_view/neumanns-random-generator

my code: https://gist.github.com/yvesklein/89d22a08504d02defc24a44b0d2be283

I'm struggling to get the loop to work properly–with everything i've tried, i can only get it to go through once or it goes on forever.
>>
What language should I learn do get an entry level job the fastest?
>>
>>61290649
Java
>>
>>61290648
dumb frogposter i hope nobody helps you
>>
>>61290649
Java is the most popular language and it's easy as shit to learn. It's also what most Android apps are written in.
>>
>>61290649
Python, JavaScript, C++
>>
>>61290649
html and JS
your job will suck, though
>>
>>61290676
More people are employed to write java than all of those combined. Stop giving shitty meme advice.
https://www.tiobe.com/tiobe-index/
>>
>>61290687
>Go is in the top 10 now
Holy shit. How? Why? What the fuck?
>>
>>61290649
java, or whatever javascript framework is currently memed lately
>>
>>61290661
i deleted it

help pls
>>
>>61290687
Of course they are. The majority of people in the world are Indian
>>
>>61290707
>The majority of people in the world are Indian
not true
>>
>>61290233

What are you actually doing here?
>>
>>61290724
Indians are a majority of people in the world.
>>
>>61290707
>>61290738
1. China has a larger population than India
2. That's a plurality not a majority
>>
>>61290745
OK well there are a lot of Indians in the world so it's no wonder why Java would be used most widely
>>
>>61290726
I just want to have the watch window dereference a pointer and show me some number of elements past the pointer, as if it were an array.

Basically the temp[0]... thing but not so onerous.
I've found that casting the pointer to an array type seems to do that (I can now collapse/expand that watch variable) but it is clearly not showing me the right values. (as you can see in the picture temp[0] doesn't give the same result in both cases).

I can't tell why.
>>
>>61290706
i was going to help you but you deleted your frog image
>>
>>61290745
3) >people
>>
>>61290703
Go targeted C++ users. Python and Ruby users are the ones who actually made the move, and that makes a lot of people.
>>
>>61290648
Do you mean the inner (while) loop or the outer?
Assuming the typo is removed:
Right now the while loop doesn't seem to make any sense since
while(!record.contains(lastString)); { //Typo here, remove the ;
count++;
[...]
lastString = String.format("%04d", lastCalc);
record.add(lastString);
}

Quite obviously record will always contain lastString past the first iteration. I'm not sure what the intent of that loop is, haven't read the problem but it should be an if statement if this is what you intend. Because it's functionally the same.
>>
>tfw struggling to find an interesting project to do in matlab to get back up to speed before I go back to grad school
Any suggestions?
>>
>>61290648
give me a while, I'm feeling generous today
>>
>>61290798
thanks, i didn't see that typo.

i mean the bunch of loops in the last for loop.

yeah, i see that it wouldn't work the way i want it to the way i have it...i'm just stuck

intent: check if the most recent value of lastString is a repetition

i THINK the way that would work would be to have lastString added to record, then go through the loop again–lastString has changed–check if its unique or not...repeat until it is

but lastString doesn't seem to change...and i'm not getting what i should do with the condition/loop to get it to run more than once, while still adding lastString values to record and checking the latest lastString against record.

>>61290837
thanks anon
>>
>>61290830
a program that prompts the user to enter a string, encrypts the string, and stores it to a file
>>
>>61290830
Find the 6th term of http://oeis.org/A003043
>>
>>61290830
something with machine learning
>>
>>61290883
Your pseudorandom function doesn't work in the first place. My advice is to make a new method just for calculating that and test it. Divide and conquer

Input: takes one integer, returns one integer

Test cases (input -> output)
1 -> 0
0 -> 0
4100 -> 8100
8100 -> 6100
6100 -> 2100
2100 -> 4100
>>
>>61290973
it has to be like this one: http://www.codeabbey.com/index/task_view/neumanns-random-generator

do you mean mine isn't working like the prompt's?
>>
>>61291031
Why would you call yourself a brainlet? Develop some self confidence
>>
>>61290467
It's bile and rancid fat. Eat less fatty foods, fatty.
>>
>>61291070
:L because these are beginner's problems but i've been getting tripped up pretty hard on a lot of them.
>>
>>61291031
Yeah, look at your inner loop, especially at val2 = values[m] * values[m]. You infinitely calculate the same number over and over again

also >>61291070
>>
File: 6532.jpg (584KB, 2448x3264px) Image search: [Google]
6532.jpg
584KB, 2448x3264px
describe your day at your programming job
>>
>>61291112
Don't give up! I believe in you
>>
>>61291177
>program
>eat
>program some more
>go home
Masturbated 3 or 4 times at work. One time forgot to lock the door
>>
>>61291177
>go to office
>go to meeting
>work on task for the say
>lunch break
>ride in bosses tesla to get lunch somewhere with other devs
>finish up work
>go home
>>
>try to rewrite OOP sepples into C
fuck this shit.
>>
>>61291430
OOP is the best paradigm.
>>
I've lost all motivation at work. Now I'm a 1/10th-er. Waiting to get fired but they gave me a raise instead.
>>
>>61291546
Maybe they gave you a raise in order to fire you
>>
>>61290883
>>61290648
Here's my take. The 0000 fucked me a bit so I used -1, but I dunno if your exam will allow that so just do a different check.
Just replace my args2 with how you are using Scanner

https://pastebin.com/dEf9wEka
>>
>>61291591
How does that make sense?
>>
I miss /prog/ and /vip/
>>
>>61291630
cheaper to pay you a little more than to keep you on for another month
>>
>>61289611
List all entries with a leading number and prompt for a number?
>>
Starting an intro to programming class in the fall that's apparently based on Python. Is there anything I should be familiar with before the class starts? Anything I should do to prepare?

Not a CS major. Trying to transfer into a Mechanical Engineering degree, a bunch of CSUs have the class AFTER the one I'm about to take as a transfer requirement. I'm taking Calculus 3 and Physics 2 at the same time so I want to be as prepared for the programming class as possible. Wanna be able to focus on Calc and Physics.
>>
>>61291721
Python should be pretty easy.
>>
File: xo4gh3.jpg (53KB, 1280x720px) Image search: [Google]
xo4gh3.jpg
53KB, 1280x720px
>>61291177
I have to make sure this xml I'm generating conforms well to this schema
It sounds like your everyday shitty wagecuck job but its more secured than the cooler projects that got laid off due to lack of budget
>>
>>61291741
I don't know the first thing about programming. I read the first few pages of a book about C in freshman year of high school but that was over a decade ago.
>>
Been programming with Java this entire semester. I'm torn between my hatred of Java and my hatred of Windows, which prevents me from moving on to .NET

what do
>>
>>61291801
learn Haskell
>>
>>61291766
C is very different to Python and has different concerns.
What will you be doing in Python?
>>
>>61291801
3rd option.
>>
>>61291721
Learn the basics: input / output, if conditions, loops, functions, maybe some light oop
>>
>>61291818
>Haskell
something useful please,
>>
File: i11961430254.png (81KB, 350x200px) Image search: [Google]
i11961430254.png
81KB, 350x200px
>>61291628
>no response
you're welcome you little nigloid
>>
>>61291853
Haskell
>>
>>61291828
No fucking clue. This is what the course catalog description says:
>First course in computer programming compliant with the standards of the Association
for Computing Machinery (ACM). This course is for students with little or no programming
experience. General computer literacy issues useful for technicians such as computer
hardware, software development, operating systems, and telecommunications.
Beginning problem-solving analysis, documentation, algorithm design, control
structures, as well as program coding using an appropriate beginning programming
language. Data manipulation, logic, looping, program testing, and program maintenance
will be stressed.

Also the description in the schedule for this specific teacher's class says:
>Using Python - Extension language for 3D and GIS.

>>61291840
Any resources that teach/explain that?
>>
>>61291546
>I've lost all motivation at work.
get a vacation asap anon, no matter the cost
go as wild as you can
burning out is extremely dangerous and harmful desu
>>
>>61291818
>>61291853 wasn't me -- I am interested in learning Haskell but I'm currently also looking for a bit of profesional experience, and most I can find using Haskell is freelance work which I don't feel experienced enough for.

>>61291832
PHP? Python + Django?
>>
>>61291914
>Any resources that teach/explain that?

I learned Python years ago so no idea about good current beginner resources. But I saw codeacademy a lot and udacity can be pretty good
>>
I want to buy into the whole Linux meme
What's the best distro for a beginner who would mainly use it for programming?
>>
>>61291546
had a similar situation, I quit my job to work on my game instead

and oh man was it worth it
>>
>>61292009
Ubuntu is nice because it has a big community, i.e. if you don't know how to do something just google
>>
>>61292009
Just get any of the noobie distros, it doesn't make much of a difference for programming.
>>
>>61291302
>>61291628
>>61291175

thanks, very helpful, all of you
>>
>>61292018
this is the way to go if you're not a brainlet and you have the motivation for it
>>
How can I check if a matrix has two equal columns in C?
>>
>>61292164
programming
>>
>>61291905
sorry, i went out for a bike ride
>>
>>61292215
That sounds nice. I haven't left my house in like 4 days.
>>
>>61292164
How do I check whether a sequence of numbers is equal to another sequence of numbers?
>>
WHAT HAVE YOU SHIPPED THIS MONTH BROS
>>
>>61292246
Check them one by one
>>
>>61291923
Thanks for the advice. How long do you think? A week? A month? I just had a 4 day weekend over the 4th but it hasnt helped much.
>>
>>61292204
>>61292246
Thanks guys
>>
>>61289173
kys animeposter
>>
>>61292278
Right and how do I check whether a single sequence of numbers is equal to a set of other number sequences?
>>
>>61292236

go for a little walk m8
>>
>>61292322
where? i live under the sea in a pineapple
>>
>>61292339
if you truly did you would be able to go for a nice walk and then stop for some patties
but u dont because you're a liar
i cant believe i trusted u
>>
>>61292305
Well a single sequence is never equal to a set of sequences so just return false.
>>
>>61292293
I'd say 10-14 days should be optimal? I don't know though. The most important thing that works for me is to try to completely change the environment around, I spent a week on my cousin's farm once: no computers, no internet, stupid discussions about stupid shit, a bit of physical work, dirty animals and a ton of tasty food. It was pretty refreshing coming back to work. Our lead spends his every year vacation in the middle of fucking nowhere cold as shit island.

Idk, try to come up with something. Hiking maybe? Travel? Stay healthy senpai. I've seen at least 3 cases of programming work severely fucking people up.
>>
>A loop must perform I/O or terminate, else the behavior is undefined.

Infinite loops can summon nasal demons in C. Why does anyone use C ironically.
>>
>>61292451
who /infinite for / here
for(;;) {
/* code here */
}
>>
>>61292462
#define ever (;;) {}

int main(void)
{
for ever
}
>>
>>61292451
I like this post.
>>
>>61292451
Where are you getting this from?
>>
constexpr auto _("tfw no gf");
for (;_;)
>>
>>61292451
wrong
>>
Lol wtf is that?
>>
Am I likely to get in trouble if I bake cupcakes for my coworkers but I make them with hot peppers?
>>
>>61292451
Infinite loops can not summon nasal demon you loon.
>>
>>61292549
why would you do that lol. you'll piss them off and you might get charged with assault if they're strong enough peppers
>>
>>61292549
Depends on your coworkers
>>
>>61292402
Ur one cheeky cunt
>>
>>61292575
What if I tell them before they eat them that they might be a little bit spicy?
>>
>>61292575
>might get charged with assault

Only Murrika Things
>>
>>61292549
if you work in a broculture startup it could be a fun prank on your bros
>>
File: 498225140716.jpg (9KB, 300x300px) Image search: [Google]
498225140716.jpg
9KB, 300x300px
i have that one project in c++ full of boost, so i started lately replacing it with std classes like shared_ptr, threads and other, its 2017 ffs, but shit just doesnt feel right. the problem here is that i wont get rid of boost anyway, theres too much shit that i use that is not in stl. i also compile it on different compilers for win/debian, implementation shouldnt differ but who the fuck knows im thinking about switching back to boost. whats /g/'s general opinion on boost?
>>
>>61292639
why would you use jpeg for such an image
>>
>>61292639
The question is
does this project work as intended?
>>
I think I'm gay, how do I check?
>>
>>61292711
Put things in your butt
>>
>>61292668
it compiles on windows in gcc7 but i havent tried it on debian with gcc 4.9 yet, it will probably work but i still get the feeling i should not switch to stl
>>
File: c200.png (77KB, 609x415px) Image search: [Google]
c200.png
77KB, 609x415px
>>61292711
Go on a date with a guy
>>
>>61289581
This is because you're bad at programming, which is no fault of C.
>>
>>61292721
>implying a straight dude can't like things in his butt
>>
>>61290369
Because it's a very good first language that gives you a solid understanding of modern computing.
If you learn C, then Lisp, then move on to whatever else you want, you'll be in a very good place.
Instead, retards start with Node.js, Ruby on Rails, and muh pseudo-code Python, and fucking suck at the fundamentals.
>>
>>61292830
It's actually because assembly is 99999x easier to debug.
>>
Question for you programmers:

Do you indulge much in inebriation, or are you straight edge?

Just wondering if there's anybody that actually maintains a balance, or if it's best to avoid altogether.
>>
>>61292711
with python:

import gaydetectionkit

gaydetectionkit.do();
>>
>>61292945
smoked a ton of pot when i was a teen but now i only drink coffee
>>
File: The_C_Programming_Language_Logo.png (13KB, 226x240px) Image search: [Google]
The_C_Programming_Language_Logo.png
13KB, 226x240px
I am genuinely interested in learning C, but what's holding me back is the fact that I can write code in modern languages that does the same shit in a fraction of the time. Things that can be done in Python in a couple lines often seem to take up 50 lines in their C equivalent. Sure the execution is faster, but is it really worth the extra effort?
>>
>>61292988
You will better understand what your computer is doing without getting lost in assembly. It's worth it for the understanding, even if you don't like it (aka the LISP argument)
>>
>>61292776
He's too gay to be gay. Good lord.
>>
>>61293023
C is just a von neumann machine though. Computers haven't been von neumann machines for a long time. They have caches and registers and pages.

Hell even assembly abstracts away caches.
>>
I used write everything in Common Lisp but I don't really the state of cl implementations.
What statically typed and compiled language should use instead?
>>
>>61292945
Whiskey from time to time
it helps
>>
>>61292451
false
>>61292503
it's wrong tho
>>61292510
his ass
>>
am i program yet /g/
>>
>>61293130
Haskell
>>
>>61293291
1GB/s
>>
>>61293313
And?
>>
>>61293281
>unused variables
You should develop good habits from the start.
>>
>>61293130
I find sbcl to be the most tolerable of cl implementations. Clasp is incomplete but also promising.
Over time I've learned to use and appreciate Ocaml, despite that it is in spirit very opposed to the of "open-world" freedom of Lisp, in exchange of more rigorous checking of exhaustivity. Haskell is similar.
>>
>>61293401
What are you talking about? Command line arguments lol?
>>
File: 1498405470757.jpg (60KB, 618x779px) Image search: [Google]
1498405470757.jpg
60KB, 618x779px
I've just started learning bitwise operations in C.

Any idea how can I acces the 2nd LSB in an unsigned char?
>>
>>61293547
the LSB of an unsigned char is itself because it has only 1 byte
>>
>>61289173
learning powershell and perl

don't really know why, just bored. it's not like i even have a bunch of free time on my hands, i'm just procrastinating on more important things that are less convenient to be working on now
>>
>>61293575
dumb /g/ poster.
>>
>>61293547
a & 0x02
>>
>>61293607
that's the third tho, it starts at 0
>>
>>61293622
That's not how bitwise and operator works.
>>
>>61293622
>>
Woohoo I've done it
How do I install graphics card drivers now

-Sent from my Linux Desktop
>>
>>61293575
i'm assuming he means bit
>>61293547
this seems to work
#include <stdio.h>
void main(){
char a = getchar();
printf("%d\n", (a >> 1) & 0x1);
return;
}

justin@DESKTOP:~$ ./lc
a
0
justin@DESKTOP:~$ ./lc
b
1
justin@DESKTOP:~$ ./lc
c
1
justin@DESKTOP:~$ ./lc
d
0
justin@DESKTOP:~$ python3
>>> for i in ['a','b','c']: print(bin(ord(i)))
...
0b1100001
0b1100010
0b1100011
>>
>>61293651
fuck off webshit
>>
>>61293622
the third bit would be 0b0100 = 0x08
>>
>>61293607
char value(unsigned char v) {
unsigned char mask = 0x02;
return v & mask;
}

int main(void) {
unsigned char v = 29;
printf("%u\n", value(v));
return 0;
}

I don't know if I'm doing it right, but why does it print the 2 instead of 1?
>>
>>61293721
ugh it's 0x04, but not 0x02
>>
>>61293721
0x08 is the 9th bit, numbering starts at 0 with computers
>>
>>61293733
Shit, sorry. v is supposed to be 10 here, not 29.
>>
>>61293733
undefined behavior
>>
>>61293733
It's just testing if the bit is present.
If the bit is set then the result is 2, if it is not set then the result is 0.
>>
>>61293733
printf("%u\n", value(v) != 0);


ABSOLUTELY FUCK THIS CAPTCHA FUCK YOU GOOKMOOT FUCK GOOGLE
>>
>>61293721
haha you messd up
>>
>>61293739
depends if you read from left to right or the opposite
>>
File: 1482011307801.gif (280KB, 400x388px) Image search: [Google]
1482011307801.gif
280KB, 400x388px
>>61293547
>mfw it took me hours to compile my first hello world
good times
>>
>>61293757
>>61293759
Yep, that was it. Thanks. C beginner here.
>>
>>61293766
this guy >>61293622 >>61293739 messed up more or he's trolling
>>
>>61293779
>rare
>>
>>61293787
the program still prints 2 or 0 instead of 1 or 0 though. you need to do a right shift
>>
>>61293759
>newfag doesn't know about 4chan settings

>>61293130
Typed Scheme. Chicken and Racket can both do static typing.
>>
>>61293787
>muh embarrassment
buckle up, nancy
>>
File: Untitled.png (25KB, 423x388px) Image search: [Google]
Untitled.png
25KB, 423x388px
>>61293739
>>
>>61293779
dumb frogposter
>>
File: hmmmm.png (16KB, 300x250px) Image search: [Google]
hmmmm.png
16KB, 300x250px
>>61293779
>g++ hello.cpp
>./a.out
>hours

???
>>
>>61293814
It's the 3th (fourth) bit.
>>
>>61293814
I almost feel sorry for you
>>
>>61293827
subtle bait, i like it
>>
>>61293800
Not really. It's printing just fine with
printf("%u\n", value(v) != 0);


Although I really don't understand why tho, I seriously need to study bitwise operatios more.
>>
>>>/agdg/
Time for you guys to do something productive
>>
File: 9817078953.jpg (67KB, 720x960px) Image search: [Google]
9817078953.jpg
67KB, 720x960px
>>61293827
>using visual studio
>copy paste hello world
>it doesnt compile because unicode if on by default
or something like that
>>
>>61293852
>/agdg/
>productive
>>
>>61293844
because != is converting it into a 1 if it's a 2. you need to do the right shift if you want it to be purely bitwise. read my previous comment >>61293696
>>
Name one thing you like about your least favorite programming language.

I like Java's interfaces. The really help cleanly separate the interface from the implementation. I like how the docs list all known implementing classes of each interface.
>>
>>61293867
>shitposts on /dpt/
>productive
>>
>>61293852
I make the code if someone else makes the art
>>
>>61293875
Interfaces are literally just pure abstract base classes.
It's a crippled multiple inheritance.
>>
>>61293844
the second bit is 2, that's how binary works, so if you just want a true or false (1 or 0) answer you need to check if it's not 0
>>
rate my computer science course:
>D is for Digital
>K&C 2nd ed
>The Unix Programming Environment
>The Algorithm Design Manual
that's it
>>
>>61293875
I like the C in C++.
>>
>>61293893
What? Not even remotely.
>>
>>61293871
>>61293896
Oh, right, that's obvious.
>>
>>61293907
wrong, remotely!
>>
>>61293875
constexpr
>>
>>61291177
>>61291177
> Get up at 5.30am
> Go for a run, with a walk for a cool down
> 100 crunches
> Shower
> Breakfast
> Tube at 8am
> In work for 9am
>Meeting at 9.45
> do nothing rest of the day
> Rinse, repeat
>>
is there any good approach to reading and understand the source of some big program that has tons of files and shitloads of includes all over the place

i start by opening it in visual studio in order to easily jump between definitions and whatnot, though even then it's already coming up with a million errors such that i wont even make it to the point where i can compile the code without touching it at all
>>
>>61293950
const int array_size1 (int x) {
return x+1;
}
// Error, constant expression required in array declaration
int array[array_size1(10)];

>this is a compile error
really?
>>
>>61293982
>returning a const int is the same as constexpr
>>
>>61293982
int array_size1(int x) const
>>
>>61293982
you can't be this stupid
>>
>>61293875
Python
I like list comprehensions. I like *args and **kwargs.
>>
>>61294025
> I like *args and **kwargs.
Why? Just build your list or dictionary outside the function.
>>
>>61294035
>just write it in asm
>>
>>61289847
Jumping into C++
I made a 2^(2^n) calculator (off by one Fermat numbers)
tried to get to 2^(2^40) a 330 billion digit number, but I only managed to calculate 2^(2^33), a 2.58 billion digit number
I don't know why I wanted to, it just felt interesting to try to find the number
>>
>>61293834
>bait

???

Or are you pretending to be retarded
>>
>>61294025
that's not a python thing, that's a shadow of functional programming you can find in python
>>
>>61294050
So you just jumped in? What books or videos did you use?
Do you have a job with the language now?
>>
>>61291177
>get to work late, like 10AM
>daily meeting at 10:30
>work or waste time until 6PM, don't take a lunch break
>lots of time to waste though, workload is quite light
>leave at ~6PM
>unless it's Friday, then I usually leave earlier
It's pretty relaxed and boring overall, with a few spikes in activity every now and then. The job is occasionally interesting but most of the time isn't, but I'm very happy with the conditions, workload and most importantly the pay so far. Got a promotion this year too.
>>
>>61294175
"jumping into C++" is a book
it just explains everything quickly and succinctly. if you wanna figure out how something works in a deeper way the book assumes you'll stop and try some practice problems, it doesn't babysit you and hald your hand through explaining stuff. it was OK, not great, not terrible, just OK.
>Do you have a job with the language now?
still in college m8. read the book in HS


tho, on a sidenote, that wasn't my first programming experience. I had petit computer on my DSi. that language had no tutorial or book, just documentation of functions. After a lot of trial and error I had a text based adventure game going, it was shit.
>>
give 10 concrete reasons why php is shit. if it is worthy of being disdained so much, they should be easy to come up with. not stuff like "its a clusterfuck", thats not concrete
>>
>>61294547
Not typed language.
>>
>>61294547
google "a fractal of bad design"
>>
if i'm going into security should i go ahead and learn JS or do other shit while i wait for webassembly to catch on?
>>
>>61294547
inconsistent standard library function naming and argument conventions
weak typing makes error detection nightmarish (many functions return false on failure but may return 0 on success)
disgusting OOP syntax. self::$static_variable but $this->instance_variable
Your only built in collection type is the array. Which is also a stack. Which is also an ordered hashmap.
Objects are reference types even though everything else, including arrays, are value types. Also, references already exist but are broken.
I don't give a fuck about any more, google it. I hate this lang.
>>
>>61294618
>security
>JS
what the fuck man
>>
>>61294600
No. That anon is talking about PHP, not C++.
>>
>>61294652
The relevant blogpost is about PHP
>>
>>61294652
>I don't know shit and just bandwagon on memes
PHP inherits the worst of C++ syntax any way.
>>
>>61294652
C++ is bad but it deserves to be left alone.
It serves some specific purposes, unlike PHP which is unforgivably useless.
>>
>>61294618
You seem to have the misconception that IT security and web stuff is intimately connected.

It's not. Other than the fact that web stuff is often a major security risk. But that's because they're morons when it comes to sanitizing data.
>>
>>61294600
reading it:
>Side observation: I loooove Python.
stopped
>>
>>61294737
even python fans can tell that php is terrible
>>
>>61294737
Even Python looks good next to PHP.
>>
>>61294712
most grad schools i'm looking at offer essentially a blue and red team concentration and i plan to go for red team since working on exploits for the nsa is my dream job
>>
>>61293875
Javascript (although a script language): you can write whatever you want, even just smash your dick on the keyboard, and the result will just 100% werk and companies will pay thousands of dollars for your shit code.
>>
File: goodmorningparu2.png (54KB, 400x237px) Image search: [Google]
goodmorningparu2.png
54KB, 400x237px
WHAT THE FUCK DO I ACTUALLY DO ABOUT SIGNEDNESS?

this fucking shit triggers me so fucking much.

say there's this fucking function that takes signed, but i actually need to show in my own function that argument can logically be only signed. or some other shitty situation where signs mix.

how do i fucking solve this?

do i cast those situations? do i disable the fucking warnings altogether? what the fuck do i do? and those fucking size_t god almighty what the fuck.
>>
>>61294857
what the fuck are you saying
>>
>>61294857
If a variable of you code only accepts positive values use an unsigned type, always. If external APIs are specified with signed types it's their problem. You don't have to use casts.
>>
I'm bored /dpt/, give me a challenge
>>
File: goodmorning1314973001425.png (50KB, 800x473px) Image search: [Google]
goodmorning1314973001425.png
50KB, 800x473px
>>61294975
>You don't have to use casts.
if only.

what do i do when i need to call some function that uses signeds? do i cast? do i actually put those fucking casts everywhere? because otherwise it's either no warning or having your warning shit up by this permanently.
>>
>>61295030
get a gf
>>
>>61295062
Give me a less challenging challenge
>>
>>61295062
you know very well that we're all gay here.

but seriously though, how to deal with signs? static_cast everything? add a function that checks conversion overflows?

unsigned was a mistake.
>>
>>61295086
When the fuck do you need to cast an unsigned number?

You aren't compiling with wall wpedantic are you?
>>
>>61295044
for fuctions that return potential error codes I do it like this usually, if that's the problem. I'm autistic about signedness in C and don;t usually encounter problems other than that.

size_t n = read(fd, buf, size)
if ((ssize_t)n == -1)
/* error handling*/;
/* proceed with unsigned n */
>>
>>61295118
i am compiling with Wsigned obviously
>>61295176
that's an old style cast. those are shit because it's hard to search for them.
>>
Is there any resources where I can learn C++ with functional programming?
>>
https://www.youtube.com/watch?v=LMTr8yw0Gk4
>>
New thread:
>>61295410
>>61295410
>>61295410
>>
>>61295312
http://en.cppreference.com/w/cpp/utility/functional
>>
>>61295420
Quite underwhelming
>>
>>61295312
C++ isn't very good for FP
Thread posts: 341
Thread images: 24


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