[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: 312
Thread images: 22

File: you wouldn't steal a car.png (119KB, 563x378px) Image search: [Google]
you wouldn't steal a car.png
119KB, 563x378px
What are you working on, /g/?


Previous thread: >>58309051
Next thread: >>58322135
>>
>>58315601
Kill yourself, trapfag.
>>
Post githubs
>>
>>58315626
Might as well use a tripcode
>>
does Python have a future?
>>
im trying to print an output of a program using sed


name: JohnDoe
address: mulholland drive
account: 0000-0000-0000
balance: $100.00
name: JaneDoe
address: mulholland drive
account: 0000-0000-0001
balance: $120.00

i need to get the last to lines

account: 0000-0000-0000
balance: $100.00
account: 0000-0000-0001
balance: $120.00

but it returns as
account: 0000-0000-0000balance: $100.00account: 0000-0000-0001balance: $120.00
>>
>>58315698
So add a newline
>>
>>58315713
To add to this, \0\n

Not sure what language you're using, but languages like c# and java also have writeline- functions which automatically add the \n
>>
>>58315601
>not casting malloc
>enjoy your stream of warnings and not being able to compile c++
>>
How do I find a business that I can write software for? How do you people find clients in need of automation or sell them on software solutions?

I've been doing software development for a few years at several companies and I'm honestly tired of getting a pittance of the money for a comparatively huge amount of actually producing.
>>
>>58315747
i'm trying to do it on a command prompt, I have a text file that will create a new one listing the the trimmed text

sed '2,4 !d' >> accounts.txt
>>
>>58315772
>warnings
Void pointer conversions are well-defined in C.
A compiler would not emit a warning for that.
>not being able to compile c++
What a pointless thing to do. Most non-trivial C code cannot be compiled as C++, especially past C99, and even then, there are semantic differences between the languages that makes the whole thing a fucking minefield.
>>
>>58315613
Kill yourself, normal human being.
>>
>>58315787
Why don't you use grep?
>>
>>58315787
When you say command print, do you mean a bash shell or a windows command prompt?
>>
>>58315946
command prompt

>>58315938
i don't know how

accounting.exe | sed '2,4 !d' >> accounts.txt
>>
>>58315772
>not being able to compile c++
Use extern 'C'
You wouldn't use malloc in a C++ file, would you ?
>>
i meant function, not file*
>>
>>58315965
grep checks each line against a regex. If it doesn't match, the line is skipped, otherwise it's output verbatim. So you want something like:
accounting.exe | grep "account|balance" >> accounts.txt
>>
>>58315632
braces
>>
>>58316007
it didn't work anon, thanks btw
>>
You are given some code from a benevolent entity. The entity requests that you demonstrably prove that you know exactly how the inner workings of the code work. You aren't allowed to execute or tamper with the code at all. How would you prove yourself?
>>
>>58316189
>stackoverflow said so
>>
>>58316189

IMPULSE RESPONSE
>>
>>58316189
what do i get in return?
>>
>>58316007
grep doesn't use regular expressions by default you need to pass -P
>>
>>58316204

You tell the being that you gleaned all of your insight from stack overflow. The entity quickly shifts from benevolent to malevolent and banishes you to the realm of new stack overflow questions for eternity.
>>
>>58316211
Big data. :^)
>>
Why is the 4chan image server such a slow piece of shit?
It wasn't always that bad.
>>
package main

import "fmt"

func main() {
fmt.Println("Hello world, you fat piece of shit")
}
>>
>>58316325
babby's first hello_world.go
>>
>>58316212
The Global Regular Expressions Print utility doesn't use regular expressions by default?

You mean it doesn't use perl's extended regexp without -P
>>
Why is sublime so expensive, I want to support the dude but seriously $70? It makes sense I guess if programming was my full-time but it's not really. Just seems like a waste
>>
>>58316189
e : \x.e
e e
x
>>
>>58316357
package main

import "fmt"

func main() {
done := make(chan struct{})
go func() {
fmt.Println("Hello world, you fat piece of shit")
done <- struct{}{}
}()
fmt.Println("Hello world, you non-deterministically slightly less fat piece of shit")
<-done
}
>>
>>58316407
Looks worse than sepples.
>>
>>58315601
Last bug fixes on a Xamarin app for Android and iOS for a product we're releasing next week.
>>
>>58316360
vs code is better anyway
>>
>>58316360
just pirate it then and buy the license later if you ever get to make money off programming
>>
>>58316360
>>58316580
>Proprietary text editors
What the fuck?
>>
>>58316430
package main

import (
"fmt"
"sync"
)

type Broadcaster struct {
m sync.Mutex
listeners map[int]chan<- interface{}
nextId int
capacity int
closed bool
}

func New(n int) *Broadcaster {
return &Broadcaster{capacity: n}
}

type Listener struct {
Ch <-chan interface{}
b *Broadcaster
id int
}

func (b *Broadcaster) Send(v interface{}) {
b.m.Lock()
defer b.m.Unlock()
if b.closed {
panic("broadcast: send after close")
}
for _, l := range b.listeners {
l <- v
}
}

func (b *Broadcaster) Close() {
b.m.Lock()
defer b.m.Unlock()
b.closed = true
for _, l := range b.listeners {
close(l)
}
}

func (b *Broadcaster) Listen() *Listener {
b.m.Lock()
defer b.m.Unlock()
if b.listeners == nil {
b.listeners = make(map[int]chan<- interface{})
}
for b.listeners[b.nextId] != nil {
b.nextId++
}
ch := make(chan interface{}, b.capacity)
if b.closed {
close(ch)
}
b.listeners[b.nextId] = ch
return &Listener{ch, b, b.nextId}
}

func (l *Listener) Close() {
l.b.m.Lock()
defer l.b.m.Unlock()
delete(l.b.listeners, l.id)
}

func main() {
var b Broadcaster
var init sync.WaitGroup
var done sync.WaitGroup
for i := 0; i < 3; i++ {
init.Add(1)
done.Add(1)
i := i
go func() {
l := b.Listen()
init.Done()
fmt.Printf((<-l.Ch).(string), i)
done.Done()
}()
}
init.Wait()
b.Send("Hello #%d, you non-deterministic, fat piece of shit\n")
done.Wait()
}
>>
>>58316772
Stop it. ;_;
>>
>>58316007
like such?

william@DESKTOP-PC:~$ cat ass.txt 
name: JohnDoe
address: mulholland drive
account: 0000-0000-0000
balance: $100.00
name: JaneDoe
address: mulholland drive
account: 0000-0000-0001
balance: $120.00
william@DESKTOP-PC:~$ cat ass.txt | sed -E '/^ac|b/!d'
account: 0000-0000-0000
balance: $100.00
account: 0000-0000-0001
balance: $120.00
>>
>>58316746
I use Emacs, but I can understand if some don't want to learn a shitload of shortcuts and just want to care about their code.
The learning curve for Vim and Emacs is steep (I haven't programmed anything in Emacs Lisp yet), VS Code and Atom rely on relatively inefficient Javascript VMs, and things like gedit are a bit too basic for their own good.
>>
>>58315626
https://github.com/enfiskutensykkel
>>
>>58316850
>VS Code and Atom rely on relatively inefficient Javascript VMs,
This is only a problem with Atom. VS code is actually optimized.
>>
>>58316887
it's time to lose weight, friend
>>
>>58316887
är det du som hela tiden brevar på norska?
>>
notelemetry.obj
>>
>>58316237

They made several changes. It blocks hotlinking too. Seems to be on a new CDN.
>>
>>58316901
https://blog.xinhong.me/post/sublime-text-vs-vscode-vs-atom-performance-dec-2016/

hmm yes """optimized"""
>>
>>58316902
Meh

>>58316904
Nei
>>
>>58316901

> Using a website to edit your code

lel
>>
>>58316925
t. fag
>>
>>58316887
>>>/fit/
>>
>>58316942
>>58316902

I don't give a fuck, and also /fit/ is filled with angsty teens that are insecure over their bodies.

Does my body trigger you somehow?
>>
>>58316934
nice argument
>>
>>58316982
No, it just could look better.
>>
kind of unrelated to thread but can anybody give me the link to a good online command line guide (beginner). Everything I find is either too complicated to unrelated.
>>
you're all nerds hahahhahahahahhahahahahhahahahah
>>
>>58316998
Well, thanks for the though. I may consider it at a later point, but I honestly just don't really care enough bother at this point in my life.
>>
>>58317011
man command

command --help
>>
>>58317011
cd
ls

You can't go wrong with those.
>>
>>58317027
>>58317033
ok thanks, im completely new to this but I really enjoy it
>>
File: imagem009.jpg (132KB, 1280x720px) Image search: [Google]
imagem009.jpg
132KB, 1280x720px
back in class
>>
>>58315747
But write-line is a common lisp function
>>
>>58317055
>But write-line is a common lisp function
>>>/out/

java:
System.out.println("foo")

c#:
something similar
>>
>>58317017
anon you should really consider changing your body.
your eye rings make it look like even your eyes want to leave your disgusting, fat body.
not to mention if i lighted up your hair you'd look like hades for an entire fucking year.
you're looking into the camera from below and you STILL look fat as fuck, not even fat landwhale tinder bitches look that fat.
>>58316325
>>58316407
>>58316772
all apply to you.
>>
>>58317050
I still want her number
>>
>>58317074
Anon, I don't fucking care. I'm sorry you get triggered by seeing fat people, but that's not my problem. In fact, I'm tempted to put on even more weight just to make you more upset.
>>
>>58317079
maybe I could be your girlfriend?
>>
>>58317101
sure
>>
>>58317096
Please don't eat me.
>>
>>58317101
This >>58317108 wasn't og number asker, but sure if you're a cute girl
>>
>>58317126
i'm a qt3.14 girl with a feminine penis, if that's okay? we can hack c together
>>
>>58317137
I would if I were gay but I'm not, sorry buddy but thanks for the offer
>>
>>58317137
this isn't me >>58317101 but it's pretty much spot on
>>
File: reee.jpg (63KB, 480x360px) Image search: [Google]
reee.jpg
63KB, 480x360px
HOW DO I LEARN C
>>
>>58317162
like anything else
>>
>>58317074
>>58316902
>>58316942

looks like someone got jealous over that guy's github, fucking kek
>>
>>58317175
that's a weak way to compensate for your weight OP
>>
>>58317162
Google a tutorial, read a few books, wear striped thigh high socks.
c is the most ladylike language, so try learning it alongside embroidery and etiquette training for optimal results
>>
>The logo of Mono is a stylized monkey's face, mono being Spanish for monkey.
what did they mean by this?
>>
>>58317193
we can't have nice things
>>
>>58317050
do they know you're posting this on 4chan?
>>
>>58317175
I, for one, am jealous of the skill of a person that deems an A* implementation worthy of his (xis?) github.
>>
>>58317174
explain

>>58317186
>Google a tutorial
I can't know which ones are memes and which aren't
>read a few books
I ordered a Modern Approach 2nd edition and K&R2. Am I good?
>wear striped thigh high socks.
lmao
>>
is there a test you can take which proves you're a master of that language?
>>
>>58317223
yeah, it's called work experience
>>
File: 1483214346015.jpg (165KB, 1032x774px) Image search: [Google]
1483214346015.jpg
165KB, 1032x774px
>>58317223
>master of the language
>>
>>58317210
I'm >>58316887 (not >>58317175) but I use my github for all sorts of crap. It's handy to have some common algorithms easily available, which is in my opinion what github is for.

Anyway, I knew what I was getting into by posting my github on /dpt/, people here are too busy shitposting than actually discussing progamming.
>>
>>58317237
how does that prove anything? what if you just programmed specifically gui for 10 years? definitely not a master
>>
>>58317220
>>wear striped thigh high socks.
>lmao
I don't know what to tell you if you're this clueless. maybe programming isn't for you
>>
>>58316887
>>58316902
>>58316942
>>58316982
>>58316998
>>58317017
>>58317074
>>58317096
>>58317121
>>58317175
>>58317185
>>58317210
This is a prime example of why no one will ever post his github on here.
SUPER bully EXTREME ~~!
>>
>>58317254
I've posted a link to my github account on here before.
>>
>>58317240
i dont find it autistic.
I just want to know where my knowledge stands with said language, so I can say without a doubt, "I'm a master at using Rust" or whatever.
>>
>>58317251
then you should reconsider your life choices
>>
>>58317223
depends on the language and what you're working with, and you're probably going to specialize in one or a few areas so maybe you're good with physics/math stuff but not networking for example

>>58317251
you could be a master of GUI dev
>>
>>58317162
Do you already know another programming language ? If you don't, learn the basic constructs of imperative programming (maybe pick Python instead for that)
Once you know that, then learn how pointers work, the difference between memory allocation on the stack and the heap, how to structure your code in modules with header files, how to compile and link them together, macros, what can or can't produce undefined behavior and how to write efficient code with the language.
>>
>>58317254
heres mine
https://github.com/andlabs

and i think he's a fat fuck
>>
>>58317266
my point is that usually jobs requires you to work only on specific tasks, ones which wont test your knowledge of using the entire language.
>>
>>58317254
It's just a bunch of jealous kids who have nothing to show themselves.

>>58317210
Post your github then, o mighty wizard.
>>
>>58317274
you've got beautiful eyes
>>
>>58317272
so youre saying its impossible to just have a master level understanding of using the whole language inside out? i feel bad for having missing pieces
>>
>>58317265
Anybody can 'master' a language in a weekend reading it's spec and docs.

If you mean 'I'm a master at programming' then you want to find a Rust project, implement a feature people ask for and then debug that feature. Repeat that for a few years and then you can call yourself a Senior Developer
>>
>>58317247
Don't worry man, I didn't mean it.
Yoobah koh ra doh ka mallo wampa mah yass ka chung kawah wookiee.
Oonyoong koosah feefty hahtoo? Oonah keejoo, nigh!
Aggh! Buh-kah. Teedee Jedi! Teedee Jedi! Oowaaaaaaaaygh! Tootaoolya! Bah! Pwegh! Pwegh! Oolyambwooba! Yahn Chass Solo chung wookiee! Oh koh loh yeah mayngabba ch’tass kun!
>>
>>58317274
>anime avatar on twitter
lol
>>
>>58317291
in a language like C++ or rust you should probably be humble enough to not call yourself a master. you could probably master a simpler language like python
>>
>>58317273
I know Python, Javascript and some Ruby, but although I get some shit done with them I can't help but to feel like I'm playing with toys
I've done some ROM hacking (with a Hex editor mostly) and while I know how pointers (and pointer tables), bits, bytes & booleans work, I still feel kinda lost with C.
>>
>>58317297
It's really funny how being fat is seriously upsetting you though. Is it tickling your autism or something?
>>
>>58317302
kek
>>
>>58317274
>repo with 3.4k stars
>friend with byuu and fiora
>actually knowledgeable
no way it's you
>>
File: hohoho.gif (1MB, 320x180px) Image search: [Google]
hohoho.gif
1MB, 320x180px
>>58317324
>>
>>58317302
>>58317274
Oh wow, he's posting meme arrows on twitter like a 9gager
>>
>>58317302
>>58317354
I think this is very cute
>>
>>58317354
>spaces between meme arrows and memes
D I S G U S T I N G
>>
>>58315601
What's wrong with casting malloc?
>>
File: 1466583701447.png (536KB, 600x720px) Image search: [Google]
1466583701447.png
536KB, 600x720px
>>58317371
this desu
>>
File: visible-autism.jpg (11KB, 199x199px) Image search: [Google]
visible-autism.jpg
11KB, 199x199px
>>58317274
>and i think he's a fat fuck
You're not so fit yourself though
>>
Should I transition for github advantages?
>>
>>58317388
>>58317381
>>58317378
>>58317371
>>58317354
>>58317353
>>58317328
>>58317324
>>58317302
>>58317297
This is why nobody posts their github on /dpt/. Stop this shitposting.
>>
>>58317380
C++ requires a cast

in C you're not supposed to, but i don't remember why
>>
>>58317380
Unnecessary in C due to implict conversions.
>>
>>58316212
Isn't it -e or egrep?
>>
>>58317380
because void pointers can be implicitly converted to any other type so it's unnecessary to cast it
>>
>>58317380
>>58317412
>in C you're not supposed to, but i don't remember why
Because it's completely pointless and all it does it repeat information.
>>
>>58317437
programming in C is completely pointless
>>
>>58317406
>having github in the first place
>cant make it private
why
>>
>>58317388
ITT: Fat fuck's calling other people fat fucks

This entire thread reeks of insecurity
>>
>>58317445
perogramming in Haskell is completely pointless

>>58317448
t. fatso
>>
File: imagem011.jpg (145KB, 1280x720px) Image search: [Google]
imagem011.jpg
145KB, 1280x720px
>>58317205
nah nigga, just caught one.
>>
>>58317447
>having github in the first place
I have it for two reasons.

The first is that every recruiter, every hiring manager, every CTO etc expects you to have one. I've even been contacted on LinkedIn by people who've encountered by github.

The second reason I have it is because I'm contributing to a project (for work) that requires me to have a github account. Sure, I could have chose not to put anything there, but meh, it's just code. People can Google my name and find my responses to the Linux kernel mailing list and see my code too.
>>
>>58317453
>perogramming in Haskell is completely pointless
Nice pun, but luckily not true.
>>
>>58317473
what's your name?
>>
>>58317454
Please tell her I want her number!!! I love Portuguese meninas
>>
>>58317503
I'm not going to tell 4chan.
>>
>>58317524
whatever, Nick.
>>
>>58317448
/dpt/ is /fit/, dummy
>>
>>58317220
I'm not sure what the Modern Approach one is, maybe you meant 21st Century C?

K&R 2nd is exactly what you need to get use the language as it is. The second book you use should ease you into setting data structures and algorithms more efficiently. If Modern can do that, you should be set as long as you aren't looking for too explicit a series of instructions.

Beyond that you want to try and just practice. Instruction is good and all but no one instruction can cover a program and introduce you to the many perspectives from which i can be viewed and relegated. Simply coding and maybe chatting about it here, or other places for that matter, will help you immensely.
>>
>>58317388
That's some nice manboobs.
>>
>>58317220
>Modern Approach 2nd edition
is all you need, throw K&R into Garbo, where it belongs to be.
>>
>>58317220
Modern is a good book, keep K&R for reference.
>>
>>58317524
i want to google you too
>>
>>58317297
MIIIKKKKKIIIIIII
>>
>>58317314
C is pencil and paper is why.

Tell me you know what to do with pencil and paper.

Not really, right? But if you have goals and the need to complete them in a timely and efficient manner then C can get it all done with a little bit of overhead time going to organization of thoughts.
>>
Transphobic maintainer should be removed from project
>>
https://github.com/wrvc
rate my github
>>
>>58317638
puts("Error compiling regex :-(");

Cute.
>>
>>58317638
>nhentai.sh
10/10 would hire
>>
>>58317653
>>58317677
ty lads
>>
File: 1481674803909.png (511KB, 836x964px) Image search: [Google]
1481674803909.png
511KB, 836x964px
>>58317677
># don't judge me
>>
do you guys still do
if (condition) {
// statements
} else if (another.condition) {
// statements
}


or
if (condition) {
// statements
}
if (another.condition) {
// statements
}


i realized that i do the second one a lot even if the first would still make sense and is faster
>>
>>58317763
Those aren't equivalent though.
You would do the second if it's possible for both sets of conditions to be true at once, and want both block of code to execute.
>>
>>58317757
cute
>>
https://github.com/airbnb/javascript/pull/698/files
>>
>>58317763
if {
}
else {
}

Only niggers put anything on the same line as the closing }
>>
>>58317763
Those are two different things.

In your first example, if condition is true, then it doesn't matter if another.condition is also true; the second block never gets executed.

In your second example, both blocks may be executed if both are true.
>>
>>58317763
in first one, if, if statement is true it wont check second statement at all.

in second, it will check all if statements.

imagine having 10 else ifs and 10 ifs..
>>
>>58317798
Only niggers don't use K&R style.
>>
>>58317763
>even if the first would still make sense
i meant it with this code in mind
while (check) {
if (condition) {
// statements
continue;
} else if (another.condition) {
// statements
return;
}
}
>>
>>58317798
Absolutely disgusting. The way clearly is
if (cond)
{
// code
}
else
{
// more code
}
>>
>>58317847
if (cond) statement1 && statement2; else statement3;
>>
>>58317847
Fuck off, rms.
>>
>>58317847
if(x){ x ? x : x }else{ x }
>>
(condition) ? (functiona) : (functionb);
>>
>>58317860
cond && statement1 && statement2 || statement3;
>>
>>58317875
nice
>>
>>58317860
if (c) s1 && s2; else s3;


>>58317872
(c) ? (fa) : (fb);


>>58317875
c && s1 && s2 || s3;
>>
condition ifTrue: [statement1; statement2] ifFalse: [statement3]
>>
Is there a low level language that's actually got modern convention and doesn't look like shit and is fast?
>>
>>58317914
C?
>>
>>58317914
C
>>
>>58317914
C
>>
>>58317916
>>58317923
>>58317940
>C
>low level
>modern
>>
>>58317947
>>low level
You don't really get any lower level than C without delving into assembly.
>>modern
The latest C standard was in 2011 and there is a new one on the way.
>>
>>58317947
you wont get faster than C (fortran shills leave)
C has asm(" ") and you can cuck the compiler by putting volatile in front of it
>>
>>58317963
>C has asm(" ") and you can cuck the compiler by putting volatile in front of it
That is a non-standard extension to C
>>
>>58317914
Rust.
>>
>>58317914
>low level
>modern

C++
>>
>>58317975
>not using GNU
lmao
>>
>>58317947
>low level
It's not low level per-se but it compiles into Assembly, so who fucking cares?
>Modern
Yes
>>
>>58317960
>C11
What did C11 bring to the table other than removing gets and adding multiplatform threading which no-one has implemented yet?
>>
>>58317914
chapel
http://chapel.cray.com/
>>
ive done mit ocw courses, written shitty gui and text based games, some ai algorithms, learnt C, python, Scheme (through SICP), done most of the /g/'s challenges to programming or know how to do the rest, use a linux learnt CS math, written a compiler that compiles to GNU assembler, learnt some webdev to realize it's absolutely trivial, have learnt algorithms, have covered a lot in some width, but not in very great depth, though reasonable depth

What the fuck am i supposed to be doing more?

i honestly feel like making porn and erotica themed games

Need some advice on where to go from here, i'm just a hobbyist
>>
>>58317987
>>58317988
I SAID NOT LOOK LIKE ASS CANCER
>>
>>58317581
Jonas Markussen

>inb4 you realise this is the name of >>58316887 which is already posted
>>
>>58317995
aligned_alloc
atomics
anon nested struct/unions
>>
>>58317995
Not much, really. Most of the interesting stuff happend in C99.
_Generic is interesting, albeit strange.
_Atomic is interesting and probably very useful, but I've never actually used it myself.
The alignment stuff is nice.
Anonymous structures/unions make using tagged unions cleaner.
Static assert, _Noreturn and several other minor things.
And some other niche stuff like <uchar.h> and some changes to the floating point headers.

Annex K is a fucking travesty though. Hopefully it gets a massive overhaul or is completely removed in the next standard.
>>
>>58318018
These are of course nice, but doesn't really make C a modern language by any standard.

I'm not saying this makes C bad though, don't get me wrong. C was always intended as a portable assembly and its simplicity has arguably made it very successful and popular.
>>
>>58318002
So make some porn and erotica games.

Also, develop a process ( over time ) where you mark the hottest points in the game at the moment and find out why, programmatically or algorithmically so that with some time you'll be able to conjure up the image and mind of the perfect waifu and we can paste her dpt and finally get rid of that bitch asuka.
>>
>>58318054
what exactly makes Python more modern than C?
>>
>>58318069
More memes.
>>
>>58317274
>>58317388
#rekt
>>
>>58318069
The cool book covers
>>
>>58318069
Powerful standard library
Being a true multiparadigm language
Not having undefined behaviour and implementation defined behaviour

In other words, exactly what >>58318072 said: More memes.
>>
>>58318069
Even more shitty ideas and poorly thought out language features
>>
so now we know who forces the animu OP images
>>
>>58318091
>extra_preargs and extra_postargs are implementation-dependent. On platforms that have the notion of a command-line (e.g. Unix, DOS/Windows), they are most likely lists of strings: extra command-line arguments to prepend/append to the compiler command line. On other platforms, consult the implementation class documentation. In any event, they are intended as an escape hatch for those occasions when the abstract compiler framework doesn’t cut the mustard.

>implementation-dependent
>>
>>58317223
The 10 000 hours meme is nit a meme
>>
>>58315683
No
>>
CS50 or MIT 6.00.1x.9?
>>
>>58318126
If a Pajeet spends 10 000 hours writing Java he will still be a Pajeet.
>>
>>58318124
Well, okay, I stand corrected. Platform-specific stuff in Python are implementation-dependent.

But still, you know what I mean. It's not like in C where you bitshift a signed integer and assume 32-bit and suddenly your hard disk is on fire and there are demons flying out your nose.
>>
>>58318150
That's the price of portability.
>>
>>58318055
thanks, i just need to figure out a story and based on that see how to implement
>>58318137
i did mit ocw 6.00(python) and 6.001(scheme)
i recommend them, but haven't done cs50

6.00 is learning various things about programming and some CS, 6.001 is the same, but it uses SICP (skips some more difficult chapters of the book)
>>
>>58318150
This is why people call it "low-level" because there is no garbage collection and making mistakes may be a problem.

On other hand, this makes it faster and more suitable to program MCUs with.
>>
>>58318150
>suddenly your hard disk is on fire and there are demons flying out your nose

You are not very good with computers I see.
>>
>>58318178
It's a fairly well-known comp.lang.c reference.
>>
>>58318143
The 10000 hour meme specifically says that these 10000 hours have to be spend actively pursuing knowledge and mastery
A pajeet learns a few tricks and then simply applies them again and again and again.
>>
File: 1466617703922.jpg (97KB, 960x870px) Image search: [Google]
1466617703922.jpg
97KB, 960x870px
>>58318178
>he hasn't had to fight back the demons of hell after messing up averaging 2 fizzbuzzes and executing LW 666

do you even program?
>>
>>58317797
>replace spaz with cuck

How utterly predictable.
>>
>>58318150
Ah yes, the nasal daemon system.
Not my favourite implementation but still.
>>
>>58318263
Kek.
>>
>>58317797
What if I interpret "quux" as an ableist slur, as well as foo and bar because they were popularized by the able-bodied fucking white males at MIT?
>>
>>58318256
Using custom allocators and making modules have own pool which will be freed once it's finished makes memory management pretty easy. And then you be extra sure with valgrind so no I have no idea about messing up averaging 2 fizzbuzzes.
>>
>>58318326
That's probably because you're using C, which can't even average ints let alone fizzbuzzes
>>
>>58318326
>averaging 2 fizzbuzzes.
"averaging two ints" is a /g/ meme
so is messing up fizzbuzz
>>
>>58318337
>muh memes
>>>/knowyourmeme/
>>
>>58318333
>>58318337
>le averaging ints maymay
I'm just going to keep posting this until you memesters shut the hell up.
That's why I wrote it.
/**
* Averages an array of integers.
*
* Averages an array of integers, without overflow or conversion to a larger type.
* It is equivalent to the sum of the array, divided by the array's length (rounded towards zero).
*
* @param n Number of array elements. Must be greater than zero.
* @param arr A pointer to an array of n integers. Must be non-null.
* @return The mean of the array's elements.
*/
int iavg(int n, const int arr[static const n])
{
int avg = 0;

/* A buffer of values that are lost to integer truncation.
* It should always be in the closed interval (-n, n).
*/
int error = 0;

for (int i = 0; i < n; ++i) {
avg += arr[i] / n;

int loss = arr[i] % n;

// error + loss >= n
if (error > 0 && loss > 0 && error >= n - loss) {
// error = (error + loss) - n
error -= n - loss;
++avg;

// error + loss <= -n
} else if (error < 0 && loss < 0 && error <= -n - loss) {
// error = (error + loss) + n
error += n + loss;
--avg;

} else {
error += loss;
}
}

// Fix some overcompensation for error

if (avg < 0 && error > 0)
++avg;
else if (avg > 0 && error < 0)
--avg;

return avg;
}
>>
If someone on your project had an unpopular opinion, would you remove them for inclusivity?
>>
>>58318381
>const int arr[static const n]
C99 fag pls.

Also
>int n
not
>size_t n
>>
>>58318381
>returns an int
doesn't work
>>
>>58318398
>unpopular
like what, you can index a linked list?
as in wrong?

or an opinion which he has to constantly spout and IS disruptive to the overall process?

yeah i would, but depends on situation
>>
>>58318381
>avg += arr[i] / n;
Potential overflow.

As we all know, signed overflow is undefined.
>>
>>58318399
I chose int on purpose. size_t could possibly cause the calculations to wider to a larger type, and many of the calculations would break with unsigned values.

>>58318401
It returns what the documentation states, idiot.
Th sum of the array, divided by the length of the array, rounded towards zero.
>>
>>58318440
I can average integers too you know

// returns 0
int returnzero() { return 0; }


does exactly what the documentation says
>>
>>58318435
>Potential overflow
No it's not.
Think about the worst case: there is an array of INT_MAX ints all with INT_MAX value.
You get "avg += INT_MAX / INT_MAX", INT_MAX many times.
There is no chance for overflow there.

>>58318461
Where does it state the the average of some integers can't return an int?
Is the / operator completely broken because it returns an int?
>>
>>58318172
Have him keep up a series of lies to keep the females' interests. And then at the end of the chapters, if he's kept it, depending on the reason they will show him some, show him more, bj, sex, etc.

I'm going to sleep while this thing writes zeros to my hard drive
>>
>>58318495
>Where does it state the the average of some integers can't return an int?
>Is the / operator completely broken because it returns an int?
Integers are not closed under division.
>>
>>58318529
So?
>>
>>58318495
>No it's not
>There is no chance for overflow there.

Try averaging INT_MIN more than INT_MAX / 2 times, it overflows because long division truncates downwards and not towards zero.
>>
>>58318561
>long division truncates downwards
No it doesn't you fucking idiot.
It's always towards zero.
#include <stdio.h>

int main()
{
printf("%d\n", -5 / 2);
}

$ ./a.out
-2
>>
Hey guys, I am trying to do a caesarian cipher(inb4 babby shit, I know) in ruby, and I fixed all the other errors I was getting, but now, for some reason, when I run it without the last end, it says "expecting keyword_end" on line 28. When I run it with the last end, I get an infinite loop that prints one seemingly random letter from the string over and over again on a new line each time. I know there must be a problem with my while loops or if/else statements, but I have googled this shit for forever and I can't find any help for this problem. Any advice on how to fix my shit, /g/?

#alphabet array written twice so shift is easier
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

#declares and assigns string and shift number
puts 'Enter string: '
str = gets
puts 'Enter shift number: '
num = gets
str.downcase!
array = str.split(//)
array2 = []
element = 0
counter = 0
while element < array.length do
while counter <= (0.5 * alphabet.length) do
if (array[element] == alphabet[counter])
array2[element] = alphabet[counter + (num.to_i)]
counter = alphabet.length
else if (counter == (0.5 * alphabet.length))
array2[element] = array[element]
counter = alphabet.length
else
counter += 1
end
end
end
string2 = array2.join
puts "#{string2}"
end

>>
>>58318582
>>58318556
-2.5
>>
>>58318591
(You)
>>
>>58318582
That's only a property of two's compliment. The standard says no such thing.

Section 6.5.5
>>
>>58318625
>with any fractional part discarded
i.e. rounded towards zero.
Wow, you seriously are retarded.
>>
>>58318619
Dumbass, learn how to average
>>
You are seriously making posts about averaging numbers.
>>
>>58318634
(You)
>>
>>58318645
Welcome to /dpt/

We take ourselves very seriously here
>>
>>58318381

It doesn't work.
>>
>>58317504
nah bro she is cute tho I will try to plow, but the bf situation...anyway Im here to learn C
>>
>>58318634
(Int)
>>
>>58318672
Tell her I'll treat her better!!!
>>
God, what a slog, it feels like my brain isn't working at all
>>
>>58318588
can someone please help, I am mostly wondering if I fucked up on the if/else statements.
>>
>>58319089
I don't know Ruby that much, but it looks similar to Lua, and I don't think you are incrementing 'element' anywhere
>>
File: 1483542008679.jpg (78KB, 351x351px) Image search: [Google]
1483542008679.jpg
78KB, 351x351px
Which book is better for a complete beginner, "C Primer Plus (6th Edition)" or "C Programming: A Modern Approach (2nd Edition)"?
>>
>>58319181
HOLY SHIT I AM RETARDED THANK YOu
>>
>>58319223
Oh, and your else statement is wrong,

tutorialspoint tells me that ruby uses
elsif instead of else if

so this is happening instead of your intended result:

if (counter == (0.5 * alphabet.length))
array2[element] = array[element]
counter = alphabet.length
else
counter += 1
end

(It's skipping one end over in the whole program)
>>
>>58319258
whoo
            if (counter == (0.5 * alphabet.length))
array2[element] = array[element]
counter = alphabet.length
else
counter += 1
end
>>
Since Moore's Law is over, the only way to make programs faster is by everyone writing hand-optimized Assembly. The whole world will be writing enterprise-grade applications one machine instruction at a time. Better brush up on your opcodes if you want a job by 2030.
>>
>>58319290
>Java is still growing in popularity
it's like, you don't want to face the reality.
>>
>>58319290
More like parallelization will be the name of the game, but sure
>>
>>58319290
Anyways, it's not like moore's law is dead, x86 is stagnant because AMD almost went out of business and ARM still isn't scalable enough to challenge server grade Intel platforms, so instead of RnD Intel spends 300 million on SJW projects
>>
wow ruby's not on.


night you guys...ermm morning.-
>>
File: sh3r.png (59KB, 966x200px) Image search: [Google]
sh3r.png
59KB, 966x200px
Currently working in an Open Source SILENT HILL 3 remake. Currently only have some basic file IO up, but we're still looking for some people to help.

https://github.com/Palm-Studios/sh3redux

Most of the file types have been reverse engineered, but fuck me, KONAMI are the biggest bunch of cunts, I swear. Some of this shit is so convoluted it's insane this spaghetti even ran on the PS2.
>>
>>58319258
Thanks man, need to fix this as well.
>>
>>58315772

C code should be compiled with a C compiler and C++ code should be compiled with a C++ compiler. Ideally, the malloc function should not be used in C++ code.

>>58317914

ISO C11.

>>58317963

>fortran shills leave
The one real advantage Fortran had in performance was removed when restrict pointers came along. Now it's just a matter of "who can make a better optimizing compiler."
>>
man, i can fizz buzz just fine but finding the biggest number in an array has got me. Don't want to google, either. Someone give me a tiny hint pls no bully

var nums = [6, 2, 4, 6, 3, 6, 9, 4, 3];

for (var x = 0; x < nums.length; x++){
for (var i = x+1; i < nums.length; i++){
if (nums[x] > nums[i]){
var highest = nums[x];
}
}
}

console.log(highest);


Looks like this just compares 2 numbers at a time so when it comes 4 and 3 at the end, it gives me 4....
>>
>>58319958
Declare highest before the loop, and one loop will do just fine.
>>
>>58319958
why not just
var highest = 0;
var nums = [6, 2, 4, 6, 3, 6, 9, 4, 3];

for (var i = 0; i < nums.length; ++i) {
if (nums[i] > highest) {
highest = nums[i];
}
}

console.log(highest);
>>
>>58319290

Hand written assembly will be wholly unnecessary. Most programs aren't bottlenecked on CPU performance, but on I/O and poor cache utilization. Hand written assembly doesn't often make a lot of sense for large scale platforms, except for maybe in a few performance-critical areas. Languages like C++ and Rust should be fine enough.
>>
>>58319865
C might be worth learning to just inline with FFI in LuaJit, true.

Theoretically, you could build a pure lua game engine like that, couldn't you?
>>
>>58319992
>>58319975

fek thats way more simple. How do i snap out of over thinking things
>>
>>58319992

Highest should be initialized to Number.NEGATIVE_INFINITY. It was not specified that the array should necessarily be all positive integers, that was only the example given. Since all numbers in JavaScript are represented as double precision floats, and since all floats representing an actual number are greater than or equal to negative infinity, we can say that negative infinity is the only proper local minimum in JavaScript.

>>58320005

A pure Lua game engine is possible, though to be honest, I would not want to use Lua except as an embedded language. Just because you can JIT doesn't mean you're going to get good performance in the general case.
>>
>>58320092
>Highest should be initialized to Number.NEGATIVE_INFINITY
perform comparison only after the first iteration
>>
>>58320061
This >>58319958 solution is slightly wrong, though. You should initialize highest to the first element of the array.
>>
>>58319992

wouldn't it be better to set highest as the first number in the array?
>>
>>58320061
kill you're self
>>
>>58320140

>you're

lel
>>
File: exit.jpg (17KB, 500x500px) Image search: [Google]
exit.jpg
17KB, 500x500px
>>58317265
>so I can say without a doubt, "I'm a master at using Rust" or whatever
>>
with C, how do i make it take a file as input, put print the output to standard output? (ie my terminal) using printf
>>
>>58320092
Yeah, I was more interested in the fact that it could achieve native-ish IO with the H/W from a scripting language.

Although I don't think the problem would be performance in general with FFI instead of bindings you can achieve performance somewhere between C++ and C#/Java, man Mike is a fucking genius
>>
>>58319958
var highest = nums.Max();
>>
>>58320157
read into a buffer and print out the buffer (use fwrite(stdout...))
repeat until EOF
>>
red spots on penis
>>
>>58320119

Setting the value to the first element in the array and iterating from the second onwards is valid solution as well, I suppose.
>>
>>58320216
was it a sniper?
>>
>>58320230
certainly, in fact it is more performant and more elegant :P
>>
File: blckngga.png (1MB, 800x908px) Image search: [Google]
blckngga.png
1MB, 800x908px
>>58320248
>more elegant :P
>>
alright i think im getting this down

var nums = [2, 22, 4, 1, 1, 3, 6, 9, 44, 3];
var largest = nums[0];
var smallest = nums[0];
var pair = nums[0];

for (var x = 0; x < nums.length; x++)
{
if (nums[x] > largest){
largest = nums[x];
}
if (nums[x] < smallest){
smallest = nums[x];
}
for (var i = x+1; i < nums.length; i++){
if (nums[x] == nums[i]){
pair = nums[x];
console.log("pair found: " + pair);
}
}
}

console.log("largest is: " + largest);
console.log("smallest is: " + smallest);
>>
>>58320166

Performance is never a problem when you're relying heavily on the FFI, because you're doing the majority of work outside of the scripting language. I think the problem with using Lua for the engine though is going to be a similar problem as using Java -- cache usage and the GC.
>>
File: imagem012.jpg (153KB, 1280x720px) Image search: [Google]
imagem012.jpg
153KB, 1280x720px
test tomorrow, will be written so can't ask you guys for help, wish me luck
>>
>>58320322
Why not just check x + 1 and only that instead of looping through every element?
>>
>>58320360
tell that linda to send me her number with a picture of herself to [email protected]
>>
>>58320357
I might try doing something simple regardless, might be cool to see how it goes.
>>
>>58320360

You shouldn't be asking us for help, even if it's a take home test.
>>
>>58320368

i tried that first but it only printed the first pair it found. What if theres multiple pairs...
>>
>>58320452
Oh, thought you wanted adjacent pairs.
>>
File: last.png (136KB, 1920x1080px) Image search: [Google]
last.png
136KB, 1920x1080px
Running another pass of american fuzzy lop on my terminal emulator, I haven't ran it since I added sixel support.

Let's see what breaks.
>>
File: 1479474022940.jpg (30KB, 872x315px) Image search: [Google]
1479474022940.jpg
30KB, 872x315px
>spend cycles keeping memory low
>spend memory keeping quick execution
Choose your poison
>>
>>58320535

Fuzz testing! That's always fun
>>
>>58320580
the latter

only cuckolds will disagree
>>
>>58320598
>a fetish somehow ties in to programming
>>
File: 1482455461130[1].png (2MB, 1200x1726px) Image search: [Google]
1482455461130[1].png
2MB, 1200x1726px
>>58320623
Where do you think you are?
>>
>>58320638
Ifunny.org?
>>
>>58320638
>C++
>no space before {
>>
>>58320580

Depends on what sort of application it is, and how high the tradeoff is on each case.
>>
if anyone can guess correctly on what this script i wrote does i'll give you a cookie

require_once 'config.php';

$folder = "//ayy/lmao/hi-res_images";
$files = scandir($folder);
$count = 0;
$qry = "UPDATE [ItemDescription] SET [part-gif] = :fullPath WHERE [ItemNo] = :itemNumInPath AND [part-gif]='';";
$insertStatement = $dbh->prepare($qry);

foreach ($files as $x)
{
$count++;
$itemNumInPath = substr($x, 0, 5);
$insertStatement->bindParam(':fullPath', $x);
$insertStatement->bindParam(':itemNumInPath', $itemNumInPath);
if ($insertStatement->execute())
{
echo $count . " - " . $x . "------success" . "<br />";
}
}
>>
>>58320694
updates some image database with some crap

php sucks why are you using it
>>
>>58320694
updates shit in that folder, ez
>>
>>58320694

You appear to be updating a bunch of files in a SQL database based on a bunch of files in a directory whose filenames indicate some sort of item number.
>>
>>58320694
>php
unexpected shit is what it does
>>
if anyone can guess correctly on what this script i wrote does i'll give you a cookie

import thing

thing.f(2) # :^ )
>>
>>58320731

because im a php programmer

>>58320733

no
>>
>>58320694
I can already tell even you have no idea on what it does
>>
>>58320756

close enough

you win a snickar doodle
>>
>>58320767
what the fuck is thing?
>>
new thread >>58320789
new thread >>58320789
new thread >>58320789
new thread >>58320789
new thread >>58320789
>>
How do I fetch the PC's date and time and store it in an Arduino sketch without using an RTC?
Thread posts: 312
Thread images: 22


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