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

What are you worjing on, /g/?

Old thread: >>59266231
>>
File: botnet.jpg (6KB, 225x225px) Image search: [Google]
botnet.jpg
6KB, 225x225px
Messenger chatbots HN says it would be future and i bought hard that meme with 5 bots.
4 in fb sdk in node js, one in meme api ai
>>
First for D.
>>
Insanity: doing the same thing over and over again and expecting different results.
x = rand();
y = rand();
z = rand();
printf("%d", x == y && y == z);
>>
>>59269865
That's not what insanity is and everyone who says that is cringe inducing.
>>
>>59269865
this won't even compile, retard
>>
>>59269875
> How to spot a literal autist
>>
>>59269884
>that plebbit space
I don't want reddit stink nearby. Fuck off.
>>
Reminder that suckless hates Java, C#, and C++. Stop using them.
>>
>>59269893
> Confirming your genuine aspergers
>>
File: 847169841228430465.jpg (26KB, 367x500px) Image search: [Google]
847169841228430465.jpg
26KB, 367x500px
>>59269875
You know what will be cringe worthy? You begging on your knees not to kill you after I unzip my Japanese Katana.. nothing personale, kiddo
>>
>>59269909
No.
>>
>>59269909
who
>>
>>59269909
Is Agda okay?
>>
Friendly reminder
>>
>>59269865
>>59269884
https://www.youtube.com/watch?v=qcA-g4VVwk4&feature=youtu.be&t=7m56s
>>
>>59269815
Every language is a Lisp in disguise. Inc
>>
Plan 9 has the best compilers because it was made by the father of C.
>>
>>59270010
This is the name of my new software company.
>>
>drop haskell because it's so hard
>look for alternatives
>none match haskell
Sigh... I guess I'll read LYAH again and do some H99.
>>
>>59270064
Read the wikibook instead of LYAH
ask questions here
>>
>>59270002
>>>/v/, buttboi
>>
>>59270064
What are you looking for?
>>
>>59270064
sml or lisp you fool
>>
>>59270108
A language that forces you to write functionally.
>>
>>59267959
There's almost no compiler that respects inline and when they do they do so against their better judgement in some situations.

Pointless keyword since when the compiler is wrong about inlining and you use it it doesn't actually do it for you.

But, something I haven't thought about before:
Since there's situations where you shouldn't inline for performance reasons are there situations where the compiler inserts function calls for efficiency? In straight imperative code that is. I haven't heard about that happening so I assume not but really why would this not happen?
>>
>>59269986
I saw some guy with stickers on the laptop.
Ultimate cringe.
>>
>>59269986
>people who consider code/syntax errors 'bugs' and make it evident in stupid jokes concerning solving bugs and introducing more bugs by solving bugs
>>
>>59270156
OCaml is easier than Haskell and you can write functionally 90% of the time (it's also worse than Haskell but that's not the point)
>>
>>59270220
OCaml isn't pure
>>
>>59270214
Is that what they meant?

>>59270159
No, it doesn't unnecessarily create new functions and calls to them. The biggest concern about badly inlining code has to do with program size
>>
I'm two months into learning to program. I feel like I'm in a rut where I'm not retaining new information and struggling to apply the information I know.

What do I do? Do I trudge onward? Do I go back and try to review old material? I have like 100 pages of notes and trying to go back through them is overwhelming.
>>
>>59270236
If you need the compiler to baby you and stop you from fucking up at every turn maybe you should give Rust a shot
>>
>>59270220
I did take a look at OCaml, but I've heard bad stories about the language.
>>
>>59269815
Benchmarking my locks against futex locks

Does anyone know if it is possible to do faster futex based locks than https://sstewartgallus.com/git?p=uevents.git;a=blob;f=benchmarks/lock-futex.h;h=60eaee656f9090eb1088b45db4d435fd9d164622;hb=HEAD
>>
>>59270250
Purity is a good thing.
>>
>>59270220
>you can write functionally 90% of the time
You can do that 100% of the time actually (also the first implementation of the CoC was made in OCaml) but I agree if you find Haskell too hard you won't benefit much from switching language.
Maybe read about lambda calculi first.
>>
>>59270214
you've never introduced a bug by solving another?
>>
>>59270280
Each of my features is a bug in disguise.
>>
>>59269986
>CS theory has no practical applications and you're gunna be jobless

I thought big data distributed auto-sharted databases, uniqueness types (I.E. Rust) and formal verification were the in thing nowadays?
>>
>>59270252
Why don't you look into the language itself instead of believing everything you hear on /g/

>>59270265
Sure, but it makes things difficult as a consequence and I'm just trying to help anon out.

>>59270271
It's p. easy to transition from OCaml to Haskell, it might be better so that you can first get used to programming functionally in OCaml, and then when you move to Haskell you don't have to concentrate on stuff like what is a lambda/what is a cons/what is a tail call, while you are focusing on harder stuff like lazy eval and higher kinded typeclasses
>>
>>59270241
>program size
No not outside of embedded. It's primarily about cpu instruction cache (which can easily get very expensive to fetch to if your inner loop doesn't fit for instance). If it was just about Executable size then nobody would frown on force inline. And there's tons of frowning on force inline.

But I haven't heard about compiler breaking up code into function calls. I'm thinking maybe people would get very uncertain about their code if they knew that the compiler will take such liberties with it. I'd certainly be uncomfortable with the idea of having the extra cost of function calls I don't know about. It'd force me to have an extra level of confidence in the compiler, and I don't.
>>
>>59270299
>Sure, but it makes things difficult
He's trying to learn

If someone trying to learn maths says it's hard, you don't give them a physics book
>>
>>59270313
Whoops, poor analogy.
Replace physics with english.
>>
>>59270280
It's an extremely rare circumstance and when you do you don't know for a long time. It's not feasible as the core element in light programming banter.

It'd be more appropriate to have jokes where you complain about whoever committed this shit code and it turns out to be you.
>>
>>59270288
I think it's more like theoretical computer science, like complexity theory.
>>
>>59269815
What is the best way to make the jump from making a bunch of basic shit to making stuff that's more complicated. I've made dozens of small shit like rock paper scissors games or functions that do shit to numbers, but how do I proceed from here? Everything seems either too trivial or too complicated to grasp.
>>
>>59270347
Project Euler maybe
>>
https://github.com/xoreaxeaxeax/movfuscator/
>cheating in computers by using more than one instruction
Pathetic.
>>
>>59270299
>Why don't you look into the language itself instead of believing everything you hear on /g/
I didn't hear it on /g/. OCaml isn't being shilled here.
>>
>>59270332

I find that suggesting an intractable rewrite project is also fairly comical.

Say you're working with 500 KLoC of C++ or something, so you ask when the Ruby rewrite starts.
>>
>>59270347
Well you find something that seems complicated and look at it until you realise it's not really complicated. A way to do that is to break up the problems into smaller steps.
>>
>>59270388
ML are by far the most practical FP languages imo. Try having a look by installing utop from opam (the package manager). There also is F# which is Microsoft's attempt at an ML-family language.
>>
>>59270423
F# is trash
>>
>>59270370
Lol. Didn't get what it was at first.
>>
>>59270370
>making your username impossible to type
i hope this guy enjoys never getting a call back
>>
>>59270458
^C ^V?
>>
>>59270423
I'll give OCaml a spin then.
I don't like F#, because MS.
>>
>>59270370
how the fuck is he adding numbers or even using basic control logic by moving registers around?
>>
>>59270458
It's literally just
XOR EAX EAX
EAX

It's a common x86 instruction plus an extra EAX for good measure.
>>
>>59270534
https://github.com/xoreaxeaxeax/movfuscator/blob/master/slides/domas_2015_the_movfuscator.pdf

https://www.cl.cam.ac.uk/~sd601/papers/mov.pdf

Pretty neat
>>
File: NEAT_Questions.png (37KB, 1204x1068px) Image search: [Google]
NEAT_Questions.png
37KB, 1204x1068px
Hey /g/
I'm trying to write a NEAT implementation from scratch. Up to now I've read the main paper from Kenneth O. Stanley but I'm left with some questions.

1)The paper doesn't mention it but, by the logic with which crossovers happens, it makes sense for neurons to have an innovation number.
So do neurons have an innovation number? And if they do is the innovation number shared with the connections or specific of the neurons?

2)When the net structure changes how do connection "feed" the network, or, to better explain myself, by what order is the infromation fed forward? (pic related)
>>
>>59270534
I could be a faggot but it a looks like he is using a lot of look up tables.
>>
File: 1488783232394.png (557KB, 433x713px) Image search: [Google]
1488783232394.png
557KB, 433x713px
Sup, /dpt/.
Done anything cool in java lately?
>>
>>59270728
smoked some drugs with the natives
>>
>>59270728
>java
>>
guys...can you please motivate me to continue learning programming?

I'm trying to learn Haskell as a first language in hopes of one day in about a year to become independent and travel around Europe or just find a nice place somewhere in the EU to get away from the gray hometown I currently live in. After Haskell I'm planning on learning PHP since it's really sought after...

Anything will do..
>>
>>59270873
this is a bait post
>>
>>59270900
it isn't tho
>>
>>59270873
>I'm trying to learn Haskell as a first language
>to meet those goals you said
HA HA HA HA HA HA HA

HA HA HA HA HA HA HA

Javascript, Java, C#, C++.

Pick one or many if your motivation is to be employed and acquire currency.
>>
>>59270900
this is bait, post
>>
>>59270873
I would imagine that haskell is really discouraging first language, so really for you sake maybe try something easier.
But it really doesn't matter because the flow is:
1. find project you want to do
2. implement it
3. goto 1

No matter what lang if you don't like what you are working on it will feel like shit.
>>
>>59270873
Wear long socks
>>
unsigned multiply(unsigned a, unsigned b){
if (!a)
return 0;
static unsigned i = a;
i = i + a;
b--;
if (b>0)
multiply(a, b);
return i;
}

So this is supposed to be a lesson in recursion without the ability to use anything other than relational, increment and decrement operators but i'm trying to get the logic down first using +.

multiply(3,7) returns 21 and multiply (7,3) returns 42 when they should both return 21. I can't figure out why it's breaking when i reverse the numbers
>>
File: 1.png (2KB, 404x404px) Image search: [Google]
1.png
2KB, 404x404px
if you have a compiled binary with libraries not available on your computer, can you still run them?
>>
>>59269815

Working on a snapchat bot for purposes. anyone know how to engineer a viral phenomenon?

Anyone want to buy an instagram crawler that harvests strings that it reads for snapchat names? You gotta hand pull all the names out tho.
>>
>>59270927
>goto
Use for/while loops fucking nigger
>>
>>59270935
THIS!
>>
>>59270940
if you linked statically otherwise no.
>>
>>59270938
multiply(a,b)
on its own does nothing.
Every time the function is called, the VALUES of a and b get COPIED as the arguments, so that when you modify a and b in the nested call, it DOES NOT MODIFY a AND b from where you called it.

unsigned multiply(unsigned a, unsigned b) {
if (a) {
a--;
return b + multiply(a, b);
}
else {
return 0;
}
}
>>
>>59270908
>Javascript, Java, C#, C++

I guess I'll go with Java then onto PHP. Thanks for stopping me
>>
>>59270927
where can I find projects to do? You won't find a person with less imagination than me, trust me.
>>
>>59270927
Step1: var muhProject = FindProjectYouWantToDo(); goto Step2;
Step2: ImplementProjectYouWantToDo(muhProject); goto Step3;
Step3: goto Step1;
>>
>>59270246
Just trudge on. You'll feel like you aren't learning anything and that you can't really remember what you have learnt.

But if you pay attention you can see that you're doing more complicated things, with fewer mistakes and faster.
>>
>>59271012
I can't imagine that I would.
>>
>>59270938
Your code doesn't even compile
multiply.c:6:25: error: initializer element is not a compile-time constant
static unsigned i = a;
^
1 error generated.
>>
>>59269851
ick
>>
>>59270246
Have you tried starting a project of some kind? There's only so much you can learn from exercises, and so many things you might not realize you need to learn without doing something for real.
>>
>>59270250
>purity is only about safety
If the programmer can reason better, so can the compiler. Hence way more opportunities for optimization.
>>
>>59270938
int mult(int a, int b, int c) {
if (!a || !b) return c;
c += a;
mult(a, b--, c);
}
>>
>>59271175
>+=
>>
>>59271163
No. I tried to do exercises from another place but a lot of them were exercises that required knowledge of stuff I haven't learned yet.
>>
>>59270991
I thought the solution for that would be the static i variable. I don't see why it works for one case but not the other.

>>59271082
It compiles fine for me.

>>59271175
I had to use the prototype given to me.
>>
>>59271209
Which language?
>>
>>59271175
Recursive in a non tail call language. Disgusting.
>>
>>59271209
>a lot of them were exercises that required knowledge of stuff I haven't learned yet
Then learn those things.
>>
>>59271219
Python. I'm learning from this book
http://openbookproject.net/thinkcs/python/english3e/
I'm on chapter 13
>>
>>59271228
recursion is pretty cumbersome in all but a few situations, and those were mostly invented to make recusion look good.

If you need your compiler to optimize your shitty recursive wank into a an iterative loop, maybe you shouldn't use recursion.
>>
>>59271262
(You)
>>
>>59271209
Well, I'd recommend starting a small-ish project you think you could do with what you know. Mess around, get comfortable with what you know before going forward.
>>
>>59271254
Do you want a suggestion as far as exercises go?
>>
>>59271262
>your compiler to optimize your shitty recursive wank into a an iterative
My compiler is named OCaml, and I'm paid to use it every day.
>>
>>59271278
What is it?
>>
>>59271082
unsigned multiply(unsigned a, unsigned b){
if (!a)
return 0;
static unsigned i;
i = a;
i = i + a;
b--;
if (b>0)
multiply(a, b);
return i;
}


I changed it to this and now it compiles fine. The reason is that static variables should be initialized to compile time constants.

Ok, so now with that out of the way, do you know how static variables work? When you do multiply(3,7), i becomes 21. Now, i will preserve its value even when it returns to main. So, in the computation of multiply(3,7), since you're just adding to i, it will become 21+21 = 42. If you don't belive me, run the program two times and change the order of the multiply() calls.
>>
>>59271292
Try building a chess engine in your language of choice. Here's a wiki that explains many concepts. You can also get help from previously done projects.
https://chessprogramming.wikispaces.com/Python
>>
>>59271327
Correction:
unsigned multiply(unsigned a, unsigned b){
if (!a)
return 0;
static unsigned i = 0;
i = i + a;
b--;
if (b>0)
multiply(a, b);
return i;
}
>>
Anyone help?

>>59271317
>>
>>59271408
less than or equals to
>>
>>59271408
i = 0; i < line->longest

<=
>>
>>59271447
Programming in C is so intuitive, it even has the "down-to" operator
int n = 10;
while (n --> 10) { // Down-to operator
printf("%d\n, n);
}
>>
>>59271327
>>59271344

Oh, I didn't realize it would hold the value even after the function terminated. Thank you for that
>>
>>59271432
>>59271447
Oh yeah thanks.
>>
>>59271478
?n --> 10

It is "n-- > 10" ?
>>
>>59271478
That loop will make demons fly out your nose.

>signed overflow is undefined behavior
>>
>>59271478
>n = 10
>n --> 10 // "down to 10"
>n is now 9
>nothing was ever printed
>>
>>59271478
>>59271501
No it won't, it doesn't do anything.

int n = 10;
while (n --> 10) {
>>
>>59271501
That loop won't do anything since n <= 10.
>>
>>59271528
>doesn't do anything
It decrements n.
>>
>>59271478
>>59271489 >>59271501 >>59271525 >>59271528
I meant
while (n --> 10)
>>
>>59271549
FUCK
while (n --> 0)


"n goes down-to zero"
>>
>>59271528
is this the "slides to" operator?
>>
>>59271540
True,
>>59271566
kek
>>
>>59271501
>>signed overflow is undefined behavior
Nice meme
>>
>>59271582
That anon is right. Overflow is undefined behavior in C.
>>
>>59270631
no help? ok :'(
>>
>>59271580
I think you're confusing it with the "sails to" operator
int i = 10;
// while i sails down to 0
while ( i -- \
//\
// \
_____//____\
\__________/
\
> 0 )
{
}
>>
>>59271649
kek
>>
if (a < INT_MAX) a += 1;


>INT_MAX+1 is undefined
>hence if clause is unnecessary
>every sane compiler will throw it away
>C or Undefined Behaviour: The Language
>>
File: GRAVITY.jpg (19KB, 788x367px) Image search: [Google]
GRAVITY.jpg
19KB, 788x367px
the NEW LANGUAGEE.... GRAVOTY

LIKE SWIFT BUT BETTTER

func main() {
// initialize a new vector object
var v1 = Vector(1,2,3);
// initialize a new vector object
var v2 = Vector(4,5,6);
// call + function in the vector object
var v3 = v1 + v2;
// returns string "[5,7,9]"
return v3.String();
}
>>
File: programming_meme.jpg (32KB, 694x801px) Image search: [Google]
programming_meme.jpg
32KB, 694x801px
Do y'all have any more of such memes?
>>
>it's another "the self proclaimed geniuses of /g/ that hold C as the pinnacle of programming take 50 posts to implement recursive multiplication function" episode
>>
>>59271732
looks verbose
    v1 =: 1 2 3
v2 =: 4 5 6
v1 + v2
5 7 9
>>
>>59271732
I hate it.
>>
>>59271759
Try to average two numbers before you talk
>>
>>59271732
That's so dumb
>>
>>59271835
> a = (1 + 3)/2;

There.
>>
>>59271749
No, that's the only known one in existence.
>>
>>59271732
How do I know those are new objects and not a static method?
>>
>>59271918
Sad!
>>
How do I do matrix addition in C without operator overloading?
>>
>>59269909
suckless is satire, it's not meant to be taken seriously
>>
>>59271929
>static method
it's called a procedure
>>59271951
neither are you
>>
>>59271944
Write a function? Do it the way it's supposed to be done?
>>
>>59271960
>it's called a procedure
Not an argument.
>>
>>59271962
a function that returns a matrix struct type?
ok

how do I return a matrix product as a struct and not a pointer to malloc'd memory?
>>
>>59271978
for what
>>
>>59271944
struct vector_two_of_integers *
vector_two_of_integers_add(struct vector_two_of_integers *lhs, struct vector_two_of_integers *rhs)
{
struct vector_two_of_integers *out;
vector_two_of_integers_create(out);

out->x = lhs->x + rhs->x;
out->y = lhs->y + rhs->y;

return out;
}


Repeat for v3 and v4 as well for every data type you have.
>>
>>59271759
C is Cancer and it needs to die ASAP.
NSA stop shilling C.
>>
>>59271981
You could do Add(Mat *a, Mat *b, Mat *c)
>>
>>59271960
Suckless is somewhat equal to /g/. Edgy toddlers' hugbox.
>>
>>59272027
C will still be the language of computing at he turn of the century.
>>
>>59272052
I love C, but the language of computing is Fortran, not C.
>>
Best way to hold a text file in a datastructure for a text editor? Gut reaction is a vector of unbounded strings.
>>
>>59272072
>Fortran
Amen.
>>
>>59272052
>civilization will last 83 more years
>>
File: 1487566059977.jpg (175KB, 1000x818px) Image search: [Google]
1487566059977.jpg
175KB, 1000x818px
>>59269877
Hey guys found another autist!
>>
>>59271981
>how do I return a matrix product as a struct and not a pointer to malloc'd memory?
Just return the struct as it is, doesn't matter if it was malloc'd or part of the stack of the add function. In your calling function, when you do
Matrix C = Add(Matrix A, Matrix B), all the field values are copied to the matrix C. The compiler usually optimizes this by sending the address of C to the Add function which directly modifies the fields.
>>
>>59272052
C was built around 80's model of computing.
It assumes you still use 800MHz single core processor.
It assumes you have 64MiB memory.
It has zero (ZERO) concept of security
It assumes you are producing binaries that needs to be ported with a floppy disk.
C holds back technology.
C is Cancer that does not address the fact that hardwares have evolved so much.

C is a cancer that plagues the software industry and it needs to DIE
>>
>>59271951
It's definitely not satire. They have conferences. Still, shouldn't be taken seriously.
>>
File: 1487921166812.png (339KB, 387x550px) Image search: [Google]
1487921166812.png
339KB, 387x550px
C apologists are NSA shills plain and simple. Rust makes it harder to produce vulnerable programs as it actually implements safety precautions like Bounds checking, dangling pointer prevention, data race prevention, lifetimes etc. This is against the interest of the NSA and so they are shilling C so that people continue to produce exploit prone, unsafe and vulnerable programs.

Ignore the NSA/C shills. Programming in C should be banned and outlawed.
Say no to security exploits, say no to the NSA. Your data and your privacy is worth preserving.
>>
>>59272099
Will you ever get tired of your constant shitposting?
>>
>>59272138
You simply can't refute. That's how shitty C(ancer) is
>>
>>59272144
Ok kid.
>>
>>59272154
Thanks for your effort, NSA
>>
>>59272099
>>59272132
are you the autistic coffee mycotoxin spammer on /ck/?
>>
>>59272132
If you cared about data and privacy security you'd be shilling free software not fucking rust. When it comes to security. C is the least of your problems.
>>
>>59272132
Have you even written anything in Rust? I'd have a hard time believing you have since you spend all your time shitposting here
>>
File: slcon2013-s.png (424KB, 600x450px) Image search: [Google]
slcon2013-s.png
424KB, 600x450px
>>59271951
>>
>>59269815
A stupid program in java, still going to school so i sadly don't understand too well these things
>>
>>59272175
How is rust not free software?
>>
>>59272175
Rust is a free software
>>
>>59272175
>C is the least of your problems.
Heartbleed says hi
Cloudbleed says hi
FFMPeg vuln says hello
>>
>>59272072
>language of computing is Fortran, not C.
it depends. In my department particle physicist I know use C++, astrophysicist use C and material scientists use Fortran. All of these do HPC. I am forced to use Fortran too because professor knows only Fortran.
>>
>>59272193
*yet
>>
>>59272205
>>59272206
I never said rust wasn't free software.
>>
>>59272226
Which ffmpeg vulnerability?
>>
>>59272238
http://news.softpedia.com/news/zero-day-ffmpeg-vulnerability-lets-anyone-steal-files-from-remote-machines-498880.shtml
>>
>>59272226
>Heartbleed says hi
>Cloudbleed says hi
>implying those are issues with the implementation language
>implying you have a clue what you are talking about anyways
>>
>lead developer is forced to conduct interview for HR
http://workplace.stackexchange.com/questions/86142/candidate-brought-parent-to-interview

Why are programmers so autistic?
>>
>>59272271
Top quality damage control NSA.
>>
>>59272227
>particle physicist I know use C++
I hope they didn't fall for the OOP meme. There's a guy in the math dept's lab who implements galerkin methods using virtual functions.
>>
File: autism1.jpg (33KB, 653x395px) Image search: [Google]
autism1.jpg
33KB, 653x395px
>>59272281
>I didn't know what to do, so I just pretended she didn't exist
That's some cringeworthy autism right there.
>>
>>59272281
stallman would at least have stared at the mothers breasts
>>
>>59272451
Stallman would have banged the mother and cuck'd the father.
>>
>>59271782
thank you j poster
>>
>>59272175
>open source software
>private
>>
>started first programming job a few months ago
>lost all motivation to program for fun
Anyone else know this feel?
>>
>>59272550
>words
>word
>>
>>59272565
how is it private if im forced to share it with everybody? that is the opposite of privacy
>>
Is clang with libc++ better than g++ and libstdc++?
>>
>>59272588
No, clang is inferior and produces inferior code
>>
>>59272553
Yes.

But then I started tinkering with entry level DIY electronics and my STK600 dev board, and then I found joy in programming again.
>>
>>59272619
Proof?
>>
>>59272626
Tried getting into electronics, got demotivated from that too. Maybe I should go in another direction, something that doesn't trigger my fear of work whenever I play with it.
>>
File: 1.png (15KB, 628x308px) Image search: [Google]
1.png
15KB, 628x308px
2 weeks of programming can save you a weekend of planning.
>>
>>59272579
>how is it private if im forced to share it with everybody?
You fundamentally fail to understand how free software works. You don't HAVE to share anything: Any changes you make, you can keep to yourself. The only caveat is that if you DO choose to share the software with someone, you must also grant them access to the source code.
>>
>>59272683
There are fuses built into all devboards, even on the small arduino ones. The worst thing that's gonna happen is that you wreck your 0.02 cent LEDs and maybe blow out a capacitor.

Anyway, after working full-time during my master's and for 6 months after I graduated, I decided to go back and do a PhD. Not a lot of time to do personal projects, but the stuff I work on is so challenging (and thus fun) that I spend a lot of my private time programming on that stuff too. :)
>>
>>59272740
"You only have to let the NSA wiretap your phone if you call anyone with it."
"Facebook only has access to your information if you give it to them."
"You only have to share your code if you want let someone use it."
Not private.
>>
>>59272818
>asking people to run code they can't audit
>private
>>
What'seh job market like for embedded programmers? Embedded C must be in demand, right? Nobody learns embedded C.
>>
>>59272849
>asking the NSA to let people who's phone calls they cant audit go free
not private.

forcing me to share my private code is what open source is all about. that's the opposite of privacy.
>>
>>59272864
>asking people to run code they can't audit
>private
>>
>>59272850
I'm >>59272750

The embedded market is completely saturated. Employers know this and hire C and C++ programmers to well below average programmer salaries. My first programming job was back-end web dev (in C++ mostly, but still), and I earned a hell of a lot more than I did as an embedded developer. Hell, as a PhD student I earn almost the same as I did as an embedded dev.
>>
>>59272619
Clang doesn't produce the sort of insanity you read in gcc's outputs. It also builds much faster, warns about more problems and is more compliant than gcc.
>>
>>59272894
I want to program on Windows and you can't force me to use Linux.
>>
>>59272913
good for you
>>
>>59272875
exactly. the user not being allowed to audit the code protects my privacy.
>>
>>59272019
Disgustingly verbose.

Vec2i
Vec2f
Vec2d
Vec3i
Vec3f
Vec3d
Vec4i
Vec4f
Vec4d

Better.
>>
>>59272913
LLVM builds on windows senpai
>>
>>59272894
GCC has improved its error messages since 2.95. Try using the current version.
>>
>>59272894
nim.c:90:17: warning: '&&' within '||' [-Wlogical-op-parentheses]

That's the kind of insanity that gcc produce only if I ask. clang spit that even if I don't ask. clang coders are worse than gcc coders
>>
>>59272939
Vec 2 Int

Vec 4 Double
>>
>>59272932
idiot
and noone actually told you to release free software just to use it but of course you can't read
>>
>>59272913
Well, you're just a fucking idiot then.
>>
>>59272953
>>59272950
>>59272894
>not knowing compiler errors and warnings by heart
Obviously the solution is to program more C.
>>
>>59272882
Well if I would get into electronics I'd do it as a hobby, to distract myself from programming as much as possible. Electronics is too related to programming, plus it takes a while to git gud enough to do something useful with it afaik.

I should probably learn some math and then try to branch out. Maybe I'll find something to be passionate about outside of work.
>>
>>59272976
I know my warnings, and that one is incorrect. It shouldn't exist.
>>
>>59272963
What kind of retarded syntax is this?
>>
>>59272818
You can use software without sharing it with anyone. You can't use facebook without facebook violating your privacy. Do you also complain that you can't sell candy laced with arsenic?
>>
>>59272994
Haskell with TypeLits or Idris
it's just type application
>>
>GCC autism
I can't be bothered to deal with it.
>>
>>59272990
Well, -Wlogical-op-parentheses isn't even set when using -pedantic, so I hardly see how it's a major problem?
>>
>>59272995
I want to dispel the fiction that open source software protects privacy; the opposite is true.
>>
>>59272994
>>59273002
or would you prefer
Vec<2><Int>
Vec less than 2 greater than less than Int greater than
>>
Are you man enough to enable -traditional -pedantic -Werror?
>>
>>59273010
Except that's wrong, you're retarded, and you need to kill yourself.
>>
>>59273007
I just type
clang -o nim nim.c

I didn't ask for the stupid/silly/idiot warning
>>
>>59273028
You sure showed him tough guy
>>
>>59273010
well you failed pretty hard then
>>
>>59273022
clang: error: the clang compiler does not support '--traditional'
>>
>>59273010
So... which of the two protects your privacy better, Chrome or Firefox?
>>
>>59273002
>>59273021
You mean Vec<2, Int>?
Without the punctuation, the compiler can't possibly decide whether those are template parameters or some unrelated garbage. I don't think you're talking about a real language.
>>
>>59273010
That's why Windows programs will always perform better than Linux programs. Free programs are always of lesser quality than programs you have to pay for.
>>
>>59270156

try erlang
>>
>>59273051
No, because it's curried. It's a function that returns a function that returns a type.
>>
>>59273065
^^^this
>>
File: 1466544326223.jpg (32KB, 557x612px) Image search: [Google]
1466544326223.jpg
32KB, 557x612px
>>59273051
>Without the punctuation, the compiler can't possibly decide whether those are template parameters or some unrelated garbage.
>>
>>59273075
You're a little confused, anon. Functions "return" at runtime. Templates are instantiated at compile time.
>>
>>59273065
>windows apps always cost money
>>
File: Screenshot_2017-03-06_23-27-38.png (1MB, 1366x768px) Image search: [Google]
Screenshot_2017-03-06_23-27-38.png
1MB, 1366x768px
>>59269815
Implementing multiple selection.
>>
>>59273051
>>59273075
i.e.
Nat -> Type -> Type
not
(Nat, Type) -> Type

but they are isomorphic, so you could have done
Vec (2, Int)
instead
But that's dumb
>>
Alright shills. You have 10 seconds to tell me why I should write my next compiler in Haskell or Rust.
>>
>>59273065
>Windows programs...
This is just not the case. It is the case however that many casual user applications target Linux and Mac as an afterthought since their primary user base is on Windows.
>>
>>59269815
What am i doing wrong all i want it to do is show the length of the string

#include <stdio.h>

int length(char * p)

{

// write your code here
strlen(str);

}

main() {

int len;

char str[20];

printf("Input string:");

scanf_s("%s", str);

len = length(str);

printf("The length of string is %d. ", len);

getchar();

getchar();

}
>>
>>59273088
Oh my sweet summer child
>>
>>59273103
Tagged unions make it easy to implement tree structures, especially your abstract syntax TREE.
>>
>>59273103
That's a pretty strange question. You should write it in C, like all other compilers.
>>
>>59273091
Cute.
Will you share your safe folder?
>>
>>59273117
>>>/r/eddit
>>
>>59273103
Because Haskell is the best compiler language available.

I wrote this in 10 seconds but have a delay of 40 seconds till I can post.
>>
>>59273114
You should type return strlen(p); in the length function.
>>
>>59273123
>like all other compilers
LLVM/Clang and GCC are implemented in C++
>>
>>59273114
int strlen(char *p)
{
const char *s;
for (s = p; *s; ++s);
return (s - p);
}
>>
>>59273134
I was joking
Templates don't even do parametrics properly, let alone dependent product types.
Try Haskell
>>
>>59273114
>
scanf_s

Iunno, but doesn't scanf_s also take the length of the string?
Wouldn't be very safe otherwise.
C is a tarded language when it comes to arrays and data structures in general, they get turned into pointers the first change it gets.
>>
>>59273147
Sadly, yes. GCC did this because LLVM did it first.
LLVM was a mistake.
>>
>>59273169
>I was only pretending to be reddit
>>>/r/eddit
>>
>>59273134
>>59273169
Or much better, Idris
Haskell just for rank n types and GADTs.

You can instantiate generics at runtime
>>
>>59273123
Not an argument.
>>
It's pronounced "see-lang" or "klang"?
>>
>>59273167
char *s = p; while (*++s); return s - p;
>>
>>59273180
I actually was, "oh my sweet summer child" is what liberal women without kids (and too old to have them) say all the time
>>
Fine then, I'll learn Haskell with a compiler.
>>
>>59273192
optimize correct code is easy

correct optimized code is hard
>>
>>59273197
not an excuse
>>>/r/eddit
>>
>>59273049
Chrome respects the privacy of the programer more.
>>
What are the hardest programming challenges?
>>
>>59273191
I've always pronounced it as
"sikh-laund-gee"
>>
>>59273202
I think there's something that's supposed to teach you to learn Haskell by writing a compiler for another language

Either way, try the wikibook

>>59273214
please stop saying r****t
>>
>>59273202
i've made a Haskell compiler better than the current one, but i can only show you if we meet in person
>>
>>59273216
average of two ints in C
>>
>>59273216
Proving that P != NP (or ==).
>>
>>59273222
please stop posting and >>>/r/eddit
>>
There's nothing wrong with using Reddit. I browse /r/4chan every day. Its fun.
>>
>>59273192
char *s; while (*++(s = p)); return s - p;
>>
>>59273228
I'm in Melbourne right now, where the fuck are you mate?
>>
>>59273216
Languages are not easy or hard. They're low level (fast) or high level (slow). Programming is hard. Learn programming.
>>
>>59273238
I don't care that this is bait kys
>>
>>59273228
Sorry I live in Uganda, but I'll come when I'm done learning it.
>>
>>59273237
Can I see your ID?
>>
>>59273241
looks like reading was hard too
>>
>>59273239
what the fuck
>>
File: CoYOG5VWcAAdVlC.jpg large.jpg (8KB, 432x247px) Image search: [Google]
CoYOG5VWcAAdVlC.jpg large.jpg
8KB, 432x247px
>>59273254
>stop not being inclusive this isn't your sekkrit klubbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
>>
>>59273254
So you can reverse engineer his compiler?
>>
>>59273285
How did you know? Did you reverse engineer my post?
>>
>>59273144
>>59273167
>>59273192
>>59273239
nothing works?
>>
>>59273332
If you don't even wanna read your own error messages how can you think it fair to have others predict them for you?
>>
>>59273332
works for me
#include <stdio.h>

int length(char * p)
{
const char *s;
for (s = p; *s; ++s);
return (s - p);
}

int main()
{

int len;
char str[20];

printf("Input string:");
scanf("%s", str);

len = length(str);

printf("The length of string is %d. \n", len);
}
>>
>>59273373
Anon he's clearly stupid. Make a simpler length implementation that's more intuitive for a rookie.
>>
>>59273373
Incorrect and inconsistent code.
>return (s - p);
Remove those parenthesis
>int length(char * p)
>for (s = p; *s; ++s);
Why no space after length but a space after for. You don't like consistency?
>int length
size_t, not int
>scanf("%s", str);
Buffer overflow;
>printf("The length of string is %d. \n", len);
No check of return value
>int main()
You forgot to return a value in main

1/20 because you try
>>
>>59273390
coming right up
void strlen_for_rookies(const char *str, size_t *len)
{
for (*len = 0; str[*len]; (*len)++);
}
>>
>>59273414
couldn't care less

1/10 because you thought i care about this
>>
>>59273438
Typical of code monkeys.
>>
>>59273423
you should write *len[str]
>>
>>59273444
nah

i manage hordes of code monkeys like you

step it up
>>
>>59273454
A code monkey to manage code monkeys. You must produce so good quality software.
>>
>>59273466
yeah considering its a Fortune 500 company, kid
>>
>>59273466
Gcc team leader
>>
>>59273482
That's not incompatible. Look at what M$ produce.
>>
>>59273373
I get this error when i place scanf_s
Exception thrown at 0x0FC3E224 (ucrtbased.dll) in Project3.exe: 0xC0000005: Access violation writing location 0x00D70000.
If i place scanf
it doesn't compile in MSVS.

also i noticed you placed
int main()
unlike the original code
#include <stdio.h>

int length(char * p)

{
// write your code here


const char *s;
for (s = p; *s; ++s);
return (s - p);

}

main() {

int len;

char str[20];

printf("Input string:");

scanf("%s", str);

len = length(str);

printf("The length of string is %d. ", len);

getchar();

getchar();

}
>>
>>59273414
>Why no space after length but a space after for. You don't like consistency?
if, for, while, switch and all of that are keywords, not functions. They can, and should, be treated differently.
>No check of return value
Literally nobody cares about printf's return value. It's not a sort of error you could recover from, and all that's going to happen is that your program is not going to print any shit.
>You forgot to return a value in main
The return 0 is implicit in C99, C11, and all standard versions of C++.

Other than that, your points are accurate.
>>
I need some help on a project I'm working on.
A console application where multiple users can access it. Users are saved in a txt file, all data from one user in separate lines. Now, how do I make the data in the file as an array? Example
ID: 1|name: poo|money: 400
ID: 2|name: loo|money: 100
etc...
I want to make switching between users possible using a global variable, so that when an user switches, it will read only from the index with that same variable, but only specific elements.
Is it possible without making a db?
>>
>>59273493
>if, for, while, switch and all of that are keywords, not functions. They can, and should, be treated differently.
bla bla bla
>>59273493
>Literally nobody cares about printf's return value
Yes when one does not care about code quality.
>The return 0 is implicit in C99, C11, and all standard versions of C++.
C89 is the only C.
>>
>>59273502
this is what a relational database is for
>>
there's something wrong with my code but I literally cannot put my finger on it
var sleepCheck = function(numHours){
if(numHours >= 8 ){
return "You're getting plenty of sleep!Maybe even too much!";
}
else {
return "Get some more shut eye!";
}

sleepCheck(10);

gives syntax error pls help
btw javascript
>>
>>59273510
>I'm dumb
Thanks for your contribution anon
>>
NEW THREAD!!

>>59273523
>>
>>59273522
Next time use an indenter kiddo.
>>
>>59273491
try
scanf_s("%s", str, 20);

instead of my scanf
>>
>>59273532
Dumbass
>>
>>59273539
that's a microsoft only extension
>>
>>59273532
I hope you'll be ban for that.
>>
>>59273522
>what are closing brackets
>>
New thread:

>>59273553
>>59273553
>>59273553
>>
>>59273552
go fuck yourself then for using microshit
jesus
>>
>>59273560
sorry
still there's something wrong,but no syntax errors this time
>>
>>59273515
I know, but is it possible to do it my way? It's a console application, for older people, I'd rather they have it as simple as possible.
>>
>>59273574
honestly i tried placing this anons code >>59273373 into a web ide and it works but it doesn't in Visual Studio.
>>
File: ui_ns.webm (293KB, 1366x768px) Image search: [Google]
ui_ns.webm
293KB, 1366x768px
>>59269815
Boring UI stuff's
>>
>>59273582
I bet it doesn't print. Now guess why.
>>
>>59273127
https://mega.nz/#!RYNGlYII!eUWr59vyx9QI1IpsI3Pp_QMJsYkP0Op26fPHIrtPNPU
>>
What's the least shitty Haskell implementation?
>>
>>59273844
I saw the one cross thread as well. Thanks anon.
>>
>>59273844
You're going to have to explain that one.
>>
File: 1485307117520.png (100KB, 819x460px) Image search: [Google]
1485307117520.png
100KB, 819x460px
>>
>>59274540
GHC
>>
The janitor got rid of BOTH threads, for some reason, despite the second one being valid.
New thread, I suppose:
>>59275068
>>59275068
>>59275068
Thread posts: 327
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.