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

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

Thread replies: 255
Thread images: 28
File: pair_programming2.jpg (298 KB, 800x650) Image search: [Google]
pair_programming2.jpg
298 KB, 800x650
/dpt/ [Daily programming] Thread

Pair programming turbo edition.

Old thread is +300: >>51547490

Wat are u working on, anon-chan ?
>>
me on the left
>>
me on the right
>>
>What are the differences?
>Short version: Python 2.x is legacy, Python 3.x is the present and future of the language
>>
>>51557857
Me on the calendar
>>
>>51557857
me me
>>
File: 1422394896484.jpg (740 KB, 728x2080) Image search: [Google]
1422394896484.jpg
740 KB, 728x2080
>>51557396
rate my superior software engineering skills

(define (podd n)

(define even nn)
(if (< nn n) (odd (+1 nn)))

(define (odd nn)
(display "%d\n" nn)
(even (+1 nn))

(even 0))

(podd 100)
>>
Me on the right poster.
>>
Hey /g/
Just finished making a program that takes lisps as input and spits out all the parens so you can see how fucking retarded it is.
Let's see some examples!:
>>51557954
:~$ ./lolisp gay.lisp
(()()(()(()))(()()(())())()


Another one:
https://raw.githubusercontent.com/dimitri/pgloader/master/src/main.lisp
:~$ ./lolisp main.lisp
()()()()()()(()((())()()()(((())))))(((())(())(())(())(())()()(())(())(()())(())(())(())()(())(())(())(())(())(())(())(())()()))(()(()()))((())((((()))(())(()))(()(()())())))(()((()())(()())()))(()(())(())()(()))()(()((((())))(()())(((())(((()))(())(()())))(()()()(())))))(()((((())((()()))(()))())))(())(()(((()))((())(()))()(())))(()(((()))(()(()(()(())()()))(((()))(()()(())(())(()()))((()((())())))((((()())))(()))()(()())(()(()()))(())(()())(()())((((()())(()(())())))())()((((())(()))(()(())()(((()(()()()()))))(((((()()())))((((()))(()))(())((())(()()))(())))(()()())(()(())())))))()))))(()()(((()))(()())))(()(((())((()()))(((())))(()))()()(((()()(())(()))(()))(()()())(()()))(()(()()()()()()()))))(()(()()())(()()()((((()))(()))(()()()((((()))((((()))(()((()(())((()))))))))(()((())(((())((())))()()()())))(()))(()((())((((()()(()()())))((()()))(()))()()(()(()()())(()()())))))))))((()(())(())(())(()))(()(((((())((()))(((()())()))(((()())(()()()))))))(()))))(()(())((()(()))))(((())(())())(()())((()(())())())((()(()))())((()(()))())(()((((()())))())()((()(((()))(())(())(())(())(())(())(()))))))
>>
>>51558011
>it has lots of parentheses so it must be dumb
>>
>>51558028
This piece of proprietary software does not accept sarcastic criticism. Please cease and desist your paren-fueled rage.
>>
daily reminder that python 2 is superior to 3 in every way and there is no reason or excuse to ever use python 3.
>>
File: 2x.png (460 KB, 525x531) Image search: [Google]
2x.png
460 KB, 525x531
Faffing about with image resizing. Tried to modify EPX to work for photographs (by having it function on colors that weren't the same, but had a low delta). Results weren't promising so now I'm just doing averages.
>>
Python 3.0 was released in 2008. The final 2.x version 2.7 release came out in mid-2010, with a statement of extended support for this end-of-life release. The 2.x branch will see no new major releases after that. 3.x is under active development and has already seen over five years of stable releases, including version 3.3 in 2012 and 3.4 in 2014. This means that all recent standard library improvements, for example, are only available by default in Python 3.x.
>>
>>51558051
python 3 has unicode, async, explicit typing
>>
>>51558074
>>51558078
and anyone worth their salt uses python 2 rather than python 3.
>>
>>51558011
up next: a program that takes an article as input and spits out all the spaces between the words so you can see how fucking retarded it is
>>
>>51557954
data Even : (n : ℕ) → Set
data Odd : (n : ℕ) → Set

data Even where
zeroE : Even zero
sucE : {n : ℕ} → Odd n → Even (suc n)

data Odd where
sucO : {n : ℕ} → Even n → Odd (suc n)

parity : (n : ℕ) → Either (Even n) (Odd n)
parity zero = left zeroE
parity (suc n) = case parity n of λ
{ left even → right (sucO even)
; right odd → left (sucE odd)
}
>>
>>51557857
package main

import (
"fmt"
"net/http"
)

func main() {
resp, err := http.Head("https://www.google.com")
if err == nil {
fmt.Println(resp.Header["Content-Length"][0])
fmt.Println(resp.Header["Content-Type"][0])
}
}

Why is Go so awesome? It's like a scripting language, but strongly typed, faster and more awesome.
>>
<quote>Python 3.x is the present and future of the language
>>
Repostan from previous thread:
Working on a proxy server in python. Thing doesn't work for shit, though. I keep getting
socket.gaierror: [Errno 11004] getaddrinfo failed

Here's the relevant code I've got so far:
#conn is the client's connection.
#request is the request this program received from the client.
#req would later be used for local caching, but for now it does nothing.
req = request.partition(' ')[2]
req = req.partition(' ')[0]
if '//' in req:
port = req.partition('//')[2]
else:
port = req
port = port.partition(':')[2]
port = port.partition(' ')[0]
if port == '' or int(port) == 0:
port = 8080

if req == '':
return
respondDistant(conn, request, int(port))

def respondDistant(conn, req, port):
host = req.partition('Host: ')[2]
host = host.partition('\n')[0]
host = host.replace('www.','')
print host

diffconn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
diffconn.connect((host, int(port)))
diffconn.send(req)

#receiving an answer from the server here, left that bit out


The problem here seems to be the host. Can't figure out what I'm doing wrong, though.
It's not a firewall problem.
>>
>>51558152
>strongly typed
interface{}
>>
are japanese people good at programming?
what do they program over there in japan?
>>
>>51558154
bullshit, python 2 will always be relevant. nobody is going to waste millions so they can port to python 3 when python 2 still exists.
>>
>>51558180
>are japanese people good at programming?

Well, Matz made Ruby, after all.
>>
>>51558190
What relevance does that have when you're starting a new project?
>>
>>51558152
>It has a useful and somewhat expansive standard library, therefor it's a scripting language

Also,
>>51558167
and the reflect library. Total cancer.
>>
>>51558190
well not according to Guido van Rossum
>>
File: guido_no.jpg (84 KB, 635x480) Image search: [Google]
guido_no.jpg
84 KB, 635x480
>>51558190
Yeah, well, that's just, like, your opinion, man.
>>
>>51558133
Except articles generally have a use.
>>
>>51558203
because you'll start a new project in python 2
>>
>>51558202
So they aren't?
>>
>>51558140
looks like shit t᠎bh
>>
>>51558152
actually, that doesn't work for https://www.google.com , I was testing with another URL...

>>51558167
>>51558205
terrible!
>>
>>51558190
>python 2 still exists
[DEPRECATED]
>>
>>51558222
Why?
>>
>>51558221
>muh brain hurts
>>
>>51558259
why should I start a new project in python 3 when everything works in python 2? don't be dumb.
>>
>>51558152
>It's like a scripting language, but strongly typed, faster and more awesome.
lel, k tard, that sentence doesn't make any sense.
>>
>>51558227

heh
>>
>>51558222
nope
>>
File: 1443062162253.webm (383 KB, 416x440) Image search: [Google]
1443062162253.webm
383 KB, 416x440
>>51558271
>>
So we went from trap to loli? Nice improvement senpai.
>>
>>51558289
only an idiot would start a project in python 3.
>>
>>51558306
why not use python3
>>
>>51558306
only an idiot would start a project in <meme language>
>>
>>51558271
>everything works in python 2
>what are keyword only arguments
>what is yield from
>what are proper strings
>>
>>51558325
because nobody uses it because lack of package support.
>>
>>51558306
why
>>
>packages from Python 2 don't work in Python 3
Nice job Guido
>>
>>51558306
only a retard would use a deprecated platform
>>
>>51558389
>nobody writes stuff in it because nobody writes stuff in it
m8...
>>
>>51558389
https://python3wos.appspot.com/
>>
>>51558166
host.partition is undefined
>>
>>51558271
>raw_input
>long
>>
File: tfw.png (189 KB, 2560x2489) Image search: [Google]
tfw.png
189 KB, 2560x2489
>>51558166
TFW no one will answer, ever
>>
>>51558455
Your host is fucking undefined you twat
>>
>>51558455
Fuck off, anon, you're not me. I'm not some dumb frogposter.

>>51558444
What? I don't think it is, anon. I define host by the partitions.
Printing the host says it's correct, in any case.
>>
>Community Web site to promote Python 3
http://getpython3.com/
>>
>>51558568
what a waste of time. python 2 will be used even 10+ years from now.
>>
>>51558592
What satisfaction do you get from this?
>>
Why does /dpt/ consider Rob Pike to be a retard?
>>
>>51558592
applec᠎ucks actually believe this
>>
I'm coming to a hurdle and its really putting a damper in my motivation to learn. I can't seem to grasp GUI design (MVC) at all in JavaFX.. On desktop..

All I've been able to do so far is make a couple stupid command line apps and an android app that used jsoup to grab lotto numbers for the weeks draw from a website(translated from a command line app I made -.-)

Maybe I don't have a good enough grasp on the core language itself yet.. how and why things are used sometimes leave me lost.. Which sends me looking for answers but leads me to more complications and confusion.


Advice, tips? Help..
>>
>>51558610
he's an animu fan, what other proof do you need?
>>
>>51558619
>Advice, tips?
kill -9 self
>>
>>51558610
Because Go. UTF-8 and his work at Bell Labs were praise-worthy, but since he worked at Google he's fell off his rocker.
>>
File: Linus.jpg (125 KB, 1211x1210) Image search: [Google]
Linus.jpg
125 KB, 1211x1210
>>51558619
>Java
try C# or Swift
>>
Julia is nice. I can pretend I'm using a functional language.
function make_stream(f, acc)
return acc, () -> make_stream(f, f(acc...))
end
stream = make_stream((x, y) -> (y, x + y, (1, 1))
stream[2]()[2]()[2]()[2]()[2]()[2]()[2]()[2]()[2]()[2]()[2]()[2]()[2]()[2]()[2]()[2]()[2]()[2]()[2]()[2]()[2]()[2]()[2]()[2]()[1]
>>
Hi, /g/, I've been awake for almost 3 days now and I need some serious, but easy, logic help.

Here's the deal:
I have one array of 10 positions where the user set the value for each position and I must run it inside a for loop to execute each position for until it's values is equals to 0. But, each position is decreased one time per loop... How do I do this in C?
Here what I've:
int array[9], finished[9], i;
printf("insert values for the array: ");
for(i=0;i<9;i++){
scanf("%i",&array[i]);
}

for(i=0;i<9;i++);{
printf(arra[i]);
array[i]--;

if(array[i]==0){
finished[i] = array[i];
}
}


I'm really sorry, but I can't even explain it right.
Think of it as PiD process, the first has 2 requests to execute(array[0] = 2) and the second has(array[1] = 1) and the program must run it until all requests are equal 0, but the first process must run one time and then let the second process run one time before running his last time.

Sorry if I wrote like a animal and hope someone can help me.
>>
>>51558643
Hurdur didn't see that coming,
fuck yourself
>>
>>51558619
>MVC

wackity schmackity don't.
>>
>>51558011
Now with nicer output!
:~$ ./lolisp date-format.lisp

((((()((((((((((((((((((()(()(((()((()(((((()((()((((()((()((()((()((())((())))
((((()))((())(())())(((((((()((()((())((()(((((())((((((()(((()))((())))))((()(
))))))(((()))((((((((())))(()((((())((())((()))((()))(((((())))(()((((())()))((
())()))(())())()))(())())()))(())()))((())()))((())()))(((((())))))(((((())((()
)))))((((())())))((()))))())))((((())))(((()))))(((()))))))))))))(((())))))))))
)))(((()))))))))))))(((()))))))))))))((()))))))))))))((()))))))))))))((()))))))
))))))((((())))))))))))))(()))(()))((((((()))))))(((()))))))((((()))))))(()))))
))(()))))))(()))))))(()))))))(()))))))(()))))))(()))))))(()))))))(())))))))))((
))))))))))((((()))))(((()((())))))))))(((()((())))))))))(((())))))))))))((((()(
))))))((((()())))))((((()())))))(((()())))))((()(()())))))((((()())))))))(((()(
))))))))((()(()())))))))((((()())))))))(((()())))))))(((())))))))))((((()()))))
))((((()()))))))((((()()))))))(((()()))))))(((()))))))))(((()(()()))(((()(()())
)(((()(()()))(((()(()()))((()(()()))((())(()()))((((()())))))(((()())))))((()()
())))))((((()())))))(((()())))))((())())))))((((()())))))(((()())))))((())())))
))((((()())))))(((()())))))(((()))))))(((()))))))))(((()))))))))(((()))))))))((
())))))))))))((
>>
>>51558714
>ends with open braces
Dear god.
>>
>>51558714
>nicer
and wrong
>>
>>51558738
:~$ ./lolisp tbqhfam.lisp
()()()()()()(()((())()()()(((())))))(((())(())(())(())(())()()(())(())(()())(())
(())(())()(())(())(())(())(())(())(())(())()()))(()(()()))((())((((()))(())(())
)(()(()())())))(()((()())(()())()))(()(())(())()(()))()(()((((())))(()())(((())
(((()))(())(()())))(()()()(())))))(()((((())((()()))(()))())))(())(()(((()))(((
))(()))()(())))(()(((()))(()(()(()(())()()))(((()))(()()(())(())(()()))((()((()
)())))((((()())))(()))()(()())(()(()()))(())(()())(()())((((()())(()(())())))()
)()((((())(()))(()(())()(((()(()()()()))))(((((()()())))((((()))(()))(())((())(
()()))(())))(()()())(()(())())))))()))))(()()(((()))(()())))(()(((())((()()))((
(())))(()))()()(((()()(())(()))(()))(()()())(()()))(()(()()()()()()()))))(()(()
()())(()()()((((()))(()))(()()()((((()))((((()))(()((()(())((()))))))))(()((())
(((())((())))()()()())))(()))(()((())((((()()(()()())))((()()))(()))()()(()(()(
)())(()()())))))))))((()(())(())(())(()))(()(((((())((()))(((()())()))(((()())(
()()()))))))(()))))(()(())((()(()))))(((())(())())(()())((()(())())())((()(()))
())((()(()))())(()((((()())))())()((()(((()))(())(())(())(())(())(())(()))))))
>>
>>51558534
post sample output ie; port, ip etc.
>>
>>51558800
>c᠎uck
>>
>>51558906
At least my paren keys aren't worn down to the nub. Gimme your finest lisp work and I'll lolispify it for you free of charge friend!
>>
What's the best way of doing this in a general purpose programming language?

Table[x, {x, 2, 1000, 6}] * Table[x, {x, 1, 1000, 6}]


This multiplies every sixth even number from 2 to 1000 with every sixth odd number from 1 to 1000

>tfw mathematica is easy as shit for math stuff
>>
>>51558802
Hold on. Hoooold on. I think I've found what's causing it.
>>
>>51558939
>my paren keys aren't worn down to the nub
neither are my mouse buttons, webfag
>>
>>51558944
ArrayFire + C++
>>
>>51558980
webfag? lmao fuckin mad2thecore.
Have a pity ((((((((((you))))))))))
>>
me in the trash
>>
>>51558965
So as it turns out, HTML at the end of a line doesn't do \n but \r\n. So I still had a \r dangling off the end, that's why it didn't work.
Now off to solve the numerous other problems the code probably has.
>>
>>51558944
For loops
>>
>>51557887
>>51557892
if youre both on the left and right does that just make you still alone, anon?
>>
>>51559015
I presume you mean http? Because this has nothing to do with html.
>>
>Be me
>Lose coding job
>Try to fuck around with the django shop tutorial
>Fucking south cant go past 1.6
>Fucking around with installed apps section for hours
>Finally get it working
>Forgot to make templates
>Sigh

Is there a good way to do legitimate web programming or am I just going to want to shoot myself for the next 10 years?
>>
>>51559056
Yeah that. I guess in a way the anon who told me host was wrong was correct.
>>
>>51559058
>webdv
better jump off a cliff right away
or start learning PHP and SQL
>>
>>51558990
>memejs mad faggot confirmed
>>
File: bat.webm (2 MB, 640x360) Image search: [Google]
bat.webm
2 MB, 640x360
Ask your beloved programming literate anything.
>>
>>51559086
but anon, lolisp® was made in C © Meme Enterprises, "Making lispfags asshurt since 27/11/15"™
>>
>>51559100
Do you realize that you're not beloved?
>>
>>51559058
learn Go

>>51559100
why do you keep calling yourself "programming literate" if, IIRC, you once said that you have been programming for only 4 months?
>>
>>51559100
How do I prevent cheating in a client/server model for a rhythm game?
The problem is validating the keystrokes of the client. I have to make sure the client does not spam the server with keystrokes or create a bot that automatically presses the right keys.
>>
A calculator with GUI using Tkinter
t. Babbys first CS course
>>
>>51559209
You don't. (Not that guy.)
>>
>>51557857
if i learn C++ will i learn C in the process?
>>
>>51558678
http://pastie.org/private/onfnr0fmd64rwidlyqjsna
>>
>>51559235
Should I send over a hitsquad if I detect a cheating client?
>>
>>51559236
If you learn C++ correctly, no. And you shouldn't want to.
>>
File: umaruwp.jpg (112 KB, 1920x1080) Image search: [Google]
umaruwp.jpg
112 KB, 1920x1080
>>51559186
>>51559194
please, don't bully.

>>51559209
you can't.
>>
>>51559244
Yes.
You may accidentally kill a few legitimate people though.
>>
>>51559209
Short of monitoring the player's keyboard by webcam, you can't
>>
Gather round folks, we've extended our product line! Introducing... Hahaskel.
->::<><-><><><><><-----><><----->::<-><><><><><-----><><----->::<-><><><><><-----><
><----->::<-><><><><><-----><><----->::<-><><><><><-----><><----->::<-><><><><><----
-><><-----><><><><-----><><-----><><><><-----><><-----><-><><->::<><-><><-><><><><><
-----><><-----><-><><><><><-----><><----->$<-><-><><-><><><-><-><><-><><><><><><----
-><><-----><><><><-----><><-----><-><-><><-><><><-><-><><-><><><-><-><><-><><><-><->
<><-><><><-><><><><><-----><><-----><-><-><><-><><><-><-><><-><><><-><-><>-<-><><><-
><-><><-><><><><><><-----><><-----><-><-><><-><><><-><-><><-><><><-><-><><-><><><-><
-><><-><><><-><-><><-><><><><><><-----><><----->$<><><><-----><><-----><-><-><>-<-><
><><-><-><><-><><><-><-><><-><><><-><-><><-><><><-><-><><-><><><><><><-----><><-----
><-><-><><-><><><-><-><><-><><><-><-><><-><><><-><-><><-><><><-><><><><><-----><><--
---><><><><-----><><-----><-><><->::<><-><><><><><-----><><-----><-><><-><><><><><--
---><><-----><-><-><><-><><><-><-><><-><><><-><-><><-><><><-><-><><-><><><-><-><><->
<><><-><-><><-><><><-><><><><><-----><><-----><-><>$<-><><-><><-><><-><><-><><-><><>
<><><-----><><-----><><><><-----><><-----><->--<><><><><-----><><-----><-><><->::<><
-><><->-<><-><><-><><><><><-----><><-----><-><><-><><-><-><><-><><><-><><><><><-----
><><-----><-><>-<-><><><><><-----><><-----><-><><-><><><><><


Unfortunately it was too memey to fit in this tiny box.

:~$ ./hahaskel Config.hs | wc -c
6830
>>
>>51559307
I could do the same thing for C using braces and semicolons

>Config.hs
Fuck off
>>
>>51559330
Hey, I didn't write that hahaskel file.
I pulled that gem right off of github, as I did my lolisp files.
>>
>>51559347
>tfw no loli/sp/
>>
>>51559380
kek
>>
>>51558271
>why should I switch to iPhone or Android when my blackberry works fine?

Nice b8 m8
>>
>>51557857

I'm programming an Atmega328p in C with the avr-gcc compiler, I can understand all of the logic of all the example code I have read, but the bitwise shit confuses me

First of all: why do programmers do bitwise ORs to individual bits and bitshifts like this:

     ADCSRA |= (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0); // Set ADC prescaler to 128 - 125KHz sample rate @ 16MHz


is their a reason they don't just set the registers like "ADCSRA = 0bxxxxxxxx;"?

also, say I want to invert the last bit in a register. How could I do this with the _BV macro?
>>
>>51559243
I got it! Thanks alot!
>>
This one's a real beaut'
:~$ ./hahaskel meingott.hs
-----_-----::-<><><><>->::->->->->->--::->->->->->->->_______--$::->->->->_-><$
>___-><$><$><><><><>$<>::->->_->::->->-><$>---><$>-><$>-><$>:_->--____::_____::
<><>::->->$<><><><><>:<>::>--><--<<>-->><<::->$::<><>$-_-_-::::-><><><>::->->__
______----<><>::->->_:<>_____<><><><><><><><>_::__<><><>--<><><>_:<>_____<><><>
<><><><><>------____$<$><><><><><>__::<><>->-><><>$<><><><><>-><><><>::_::->$$$
--::<><>_<><>__::<><>__<><><><><>_::::-::_____::::--___::::::_<><>::_::::-><>__
<><><>___<>___<>_<><><>::-><><>::->->->-><$>::->->->->::->->::-><>::-><>$<><><>
<><>::-><>::$::-><>::$::->-><><><>::->-><>::->->_<>_<><><><><>::->-><><><><><><
>:_-><>_->->_->->_->_->::->->->$->$-><>$<>-><>$<>->_<><>_-><>::::->$::->->><>:-
><><>_::-><>::->::-><><><><>::->-><><><><>::-><><><>$$<$>$$<$>::<>::->->->-><><
><><>
>>
>>51559560
no one cares
>>
>>51559460
>is their a reason they don't just set the registers like "ADCSRA = 0bxxxxxxxx;"?
The reason is that when written like this, you can't see what the individual bits mean. Using bit shifting, when choosing appropriate names for the constants, it is obvious what your bit manipulation is accomplishing.

Compare:
REGISTER_MAGIC |= (1 << ENABLE_FROBNICATE_MODE);

Versus:
REGISTER_MAGIC |= 0b00000100;


Admittedly, the constant names used by the AVR library are really really terrible for that.

>also, say I want to invert the last bit in a register. How could I do this with the _BV macro?
You would write:
MYREGISTER ^= _BV(0);

But personally I wouldn't bother, and just write:
MYREGISTER ^= (1 << 0);
>>
>>51559654
About FP? I know right.
^5
>>
>>51559036
>feelsbadman.jpg
>>
>I judge the worth of programming languages by how many punctuation characters they use
>>
why is type erasure bad
>>
Now with more meme!
:~$ ./lolisp ast.lisp
:(<>)<>(<>)()(:)(:(:::)(::<>:<>::::<>:<>:<>:<>:<>:<>:<>::<>::::<>:::))(:)(<>()(
))(<>(<>)((::::)(::::)(::::)))(((<>))(()))(<>(<>)())(<>(<>)())(<>(<>)())(<>(<>)
())(<>(<>)())(<>(<>)())(<>(<>)((::::(<>))))(<>(<>)((::::<>)(::::<>)(::::<>)))()
(<>()(<>))(()(()(((())(()))(((()())(((()))((())(((>())(((<>:))))))))(((())(()))
)))))(()(()(((())(()))((()(((())(()))((>())((())(())(((())(()())())))(()()(()))
)))(((())(())))))))(():**(()))(()((()()((())(())))))(()((<>)(())))(()(((*())(*(
)))(**)))


Don't forget to like and subscribe.
>>
>>51559806
Less safety yet often also less efficient
>>
File: Selection_031.png (14 KB, 316x209) Image search: [Google]
Selection_031.png
14 KB, 316x209
What's the best format style and why is it pic related?
>>
>>51559826
Now create a triangle with the characters.
>>
is scheme a meme today?

what are you using it for?
>>
File: C unites workers.jpg (2 MB, 2000x2610) Image search: [Google]
C unites workers.jpg
2 MB, 2000x2610
>>51559933
>CPeePee
>not C
l m a o
>>
>>51559412
try typing quickly and accurately on a touchscreen. its like pulling teeth
>>
>>51559974
Scheme is a great language for learning, among other things. It's definitely not a meme.
>>
>>51559826
your shit program could be done with sed in a bash script

>>51559974
scheme sounds like a meme
>>
File: 14082176934965.jpg (282 KB, 1000x1000) Image search: [Google]
14082176934965.jpg
282 KB, 1000x1000
>>51559933
>semicolons before end of line
>>
How come GCC adds so much garbage data to the executable?

I compiled a super simple C hello world program and opened it up in a text editor. Deleting null characters left and right is really cutting down the binary size but it doesn't have any effect on the program. What gives? I've always been told that compilers are better at producing machine code than humans, but...was that just a lie?
>>
>>51559933
>std::cout
disgusting
>>
File: 6.png (20 KB, 300x300) Image search: [Google]
6.png
20 KB, 300x300
>>51560102
>and opened it up in a text editor
>>
>>51560102
GCC doesn't optimize for size by default
>>
>>51560102
debug data?
>>
>>51560122
Well, a hex editor (okteta), but the point still stands.
>>
>>51559974
schmeme you say?
:~$ ./schmeme 10-value-of-all-of-this.ss
:():::((()((())(()))))(()())(()())(()(()()))()((()((()))))()(()())(()())(()(()(
)))((()()))((()(())))((()((()))))((()(()())))((()((()())((())())((()())))))((()
())(()()))>((()())(()()))>()()()((()())(()(()())))()((()((()())((()(()(()))))))
)(((()())(()()))(()()))>((()((()())(()))))((()((()*)(()*)(()*)(()*)(()*)(()*)((
)*)(()*)(()*)(()*)(()*)(()*)(()*)(*))))((()(((())(((())*)((())*)((())*)(*)))(*)
)))((()(())))((()(())))*(*(()((())(())(())(()))))*:()(*(()()))()*(*(()()))((()(
())))*(*(()((()))))()()()((()((((()))((())))(((()))((())))((())))))((()((()())(
))))()()*(*(()(())))()((()((()())(((())(()))))))*(*(()((())(()))))()()((()(()))
)((()(())))((()((()(()))(()(())))))((()((()(()()))(()(()))(()(()))(()(()))(()((
)()))(()(:()))(()(()))(()(()))(()(()))(()(()))))):(:(()((())(())((()))((()))())
))((()(()((())()))))(())((()))()(((())))(((())))()(((()((())))(())))(())(((()((
())(()))))):::
>>
>>51560102
>GCC
>not MSVC
why live?
>>
>>51560158
>MSVC
>not MinGW
burn your computer
>>
>>51560102
The error messages I get when I delete "relevant" parts of the file is interesting.
>>
>>51560179
>MinGW
>Not even worth killing yourself
>>
File: cat.jpg (14 KB, 480x360) Image search: [Google]
cat.jpg
14 KB, 480x360
>>51560150
cat

universal meme detector

super sensitive

and cute!
>>
>>51560219
>cat
>not dog

Diesel is rolling over in his grave
>>
>>51560219
I am on board with this.
>>
>>51560158
>C89
>>
>>51558944
[even*odd for (even, odd) in zip([even for even in range(2, 1001, 12)], [odd for odd in range(1, 1001, 12])]

This does an element-wise multiply of even sixth even with every sixth odd. Unless you meant all permutations of like [1, 2, 3] * [1, 2, 3] = [1, 2, 3, 2, 4, 6, 3, 6 9].
>>
>>51560270
>C
>>
>>51560194
>>51560102

Well I managed to get a 6.6KB executable down to 2.1KB.

That means that roughly 66% of the file was useless bloat.
Is this normal? If so, why? Are programming languages just a meme, trying to stop us from using hyperefficient assembly?
>>
>>51560040
>old language
>not older language
>>
 double scale = (temp - cold) / range; //temp: 14 range: 40 cold: -10 scale: 0.0 


why is scale 0.0? 24/40 = 0 ?
>>
>>51560150
Do a standard test or something like fizzbuzz and compare languages.
>>
>>51560451
I was just grabbing stuff I found on various githubs, I don't know how to functional program nor do I want to, but if you'd like to write up some, I would be glad to memify them for you post-haste.
>>
>>51560448
What lang?

24/40 will equal 0 if 24 or 40 is being interpreted as an int.

If this is C++ or something, try this and see what happened:

double scale = (double)((double)temp - (double)cold) / (double)range;
>>
>>51560289
now try with -O2
>>
>>51560530
oh god I'm so fucking stupid
thank you, yes it was because of integer division
>>
File: scratch.jpg (67 KB, 480x270) Image search: [Google]
scratch.jpg
67 KB, 480x270
I'm having trouble understanding why Scratch exists and if it's good for children.

Because from my perspective Scratch is just another way to write code which is often coupled with a couple libraries that allow you to do basic things like opening windows, displaying images and playing sounds.

But you're never going to ship anything made in Scratch right? If text-code scares these people then why would you ever bother to help them? If it's other things that scratch does to get rid of what scares people about programming then what could that possibly be and how could you construct something which is actually helpful to their learning?

If you have a fresh Scratch baby and you want to toss it into C, Java or whatever it's very unlikely to float better just because you taught it to drag blocks and understand what a library is (loosely).

And I can't really assume the Scratch devs didn't think of this. There must be something I'm missing. Because who would write an entire language with its cool UI and stuff without having through about these things?

Personally my issues with programming was the level of abstraction I was thrown into. If I could write something similar to C code on a computer which just had buffers for character, video and audio output (and input). I have no doubt I'd have an easier time than the problems you're faced with early on in object oriented programming for instance. So why would you take away one of the few things that were solid, the code you input to the machine? Making it an almost entirely black box.

And I'm told Scratch works, there's tons of communities who try and teach kids scratch. But I don't see how at all. And what is their measure of success?
>>
>>51560648
Scratch was, to my knowledge, designed to be a not shitastic version of Alice.

Friendly reminder that there's actually a large number of high schools who teach Alice in their intro to programming classes.
>>
>>51560648
scratch is good for kids cause it is literally impossible to write programs in it that:

- have syntax errors
- crash or lock up
- run out of memory
- don't have some kind of simple visual feedback

you would be surprised how far that gets in teaching small impatient children
>>
>>51560648
>>51560672
Apparently a course I'm taking next year called "animated computing" is done in Scratch

In a university CS program
>>
>>51560451
Hello world:
:~$ ./hahaskell helloworld.hs

:~$ ./schmeme helloworld.ss
((()(()()())))

Result: schmeme is memier.

Fizzbuzz:
:~$ ./hahaskell fb.hs
_||||
:~$ ./schmeme fbrecur.ss
(()((((()))((()))((()))()))((<)(())))()
:~$ ./schmeme fb.ss
(((()))((>))((((()))((()))((()))()))())

Result: Schmeme memier.
>>
>>51560289
http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html

>>51560689
>In a university CS program
what uni?
>>
>>51560689
What shitty uni is this?
>>
>>51560648
Honestly I don't know why it exists either. There is no use in teaching kids to program, it's too abstract for them. It's something that should be introduced after kids learn algebra and their first algorithms.

Captcha was Euler Ave., lel.
>>
>>51560289
did you try using the -s flag? there are some other flags for linker to reduce size IIRC
>>
>>51560699
$ ./chit < chit.c
(){;((())!)(){';':'{':'(':')':'}':'|':'\\':'&':'\'':'\"':':':'!':();}('\');;}

oh my :^)
>>
>>51560720
>>51560725
Dalhousie in Canada

And I just looked up last year's syllabus and there's no mention of Scratch, so I guess somebody just had no idea what they were talking about when they brought it up
>>
>>51560797
That's beautiful though. Plus bracketed languages make sense!
How is bitwise operators a meme?!
Confirmed speech impediment.
>>
>>51560648
my university had the entry course for programming held in scratch. I still not understand why they did it.
>>
>>51560689
That's pretty heretical.
Though there may be reasons for it.
>>51560672
Yeah but my problem is with having an environment like that. Unless Alice was straight up harmful compared to scratch they're the same to me
>>51560685
>- crash or lock up
I'm fairly certain you can do this..
>- have syntax errors
I don't find it helpful to make logic errors out of syntax errors. And I'm having trouble picturing a kid who would have problems with a syntax error more than a logic error. Logic errors are invisible. The machine "just don't work" as I picture the child would think. While a syntax error would tell him what he did wrong and he'd go like "yeah that's not what I wanted".
>- don't have some kind of simple visual feedback
How can this not be true? If you make an intermediate calculation in scratch it's just plain visible somehow?
>- run out of memory
I guess. But really at the stage these programmers are at it'd be hard to run out of memory.

>you would be surprised how far that gets in teaching small impatient children
Yes very surprised. Especially about the syntax vs logic errors.
>>
>>51560797
but let's be real
:~$ ./lolisp tbqhfam.lisp
(:)()()()()()(()((():)(:)(:)(:)(((()):))))(**((()::)(()::)(()::)(()::)(()::)(::
:)(:::)(()::)(()::**:)(()::())(()::)(()::)(()::::)(::)(()::::)(()::::)(()::::)(
()::::)(():::)(():::)(():::)(():::)(:::)(:::)))(()((:::)(:)))(((**))(((((:)))((
))(:()))(()(()(:))(:))))(()**((()(:**::))((:)(**))()))(()(())(())(:**)((:)))(**
)(()((((:(:))))((:)(:))(((())(((:**(*:**)))((:))((**)(::::**))))(()(:)(**)(()))
)))(()((*(((:))(((:)(:***)))(()))())))(**())(()((((:)))((()**:)(:()))(:)((::)))
)(()(((()))(()((:**)(()(())()(:)))((((:)))(**(:::)**(:::)(**(:::))(**(::))(()()
)):((**()(((**))())))((((()())))(**(:)))()((::**::**)(:**))((**)(()()))(())(()(
:))(()(:))((((()(:))(()(())(:))))(:))(**)((*((**())(**()))(()(:(:**))(:**)(((()
(()(:)(:)(:)))))(((((()(:)(**))))((((()))(()))((:))((())(()()))(())))(()(:)(:))
(()(())(:))))))(:)))))(()()(((()))((:)(::))))(()(*((())((()()))(((())))(()))(::
)(::)(((()()((:))((:)))(()))(()(:)(:))(()(:)))(()(:::():():():():():():():))))(
()(()(:)(:))((:)(::)()(*((((::)))((:::)))((**)()(:)((((:(:)))((((()))(()((()(()
)((()))))))))(()((())(((())((())))(:)(:)(:)(:))))(:::(:):))(()((())(*(((:():():
:(()(::)())))(((*)()))((::)))(:)(:)(()((:)()(:))((:)()(:))))))))))((()((:**)**)
((:**)**)((:**)**)((:**)**))((:)(*((((())((()))(((()())()))(((()())(()()())))))
)(()))))(()((:::))(:(()(()))))((((:))((:))())(()())((()(())())(:))((()(()))(:))
((()(()))(:))((:)((((()())))(:))(:)(((:)(((:(:)::::))((:::::))((:::::))((::::))
((::::))((:::))((:::::))((:::::)))):)))
>>
Guys, how to "rethink" logic ?

I have a piece of logic written down that doesn't seem pretty, but there's nothing that else comes up in my mind.

How do you get into rethinking logic?
>>
>>51560825
To get women interested in programming.
>>
>Program hangs when window is moved/resized
So, I guess the correct way to fix this is to run my window/event loop on a separate thread to rendering, right?
>>
File: scratch.png (55 KB, 576x622) Image search: [Google]
scratch.png
55 KB, 576x622
>>51560648
>>
>>51560872
lol turd
$ ./chit < gnuecho.c
():();:""('')""\("")\(""){};(){(!)();{(("\:\\:\\"));(("\()\\\\\\"));((("\()\\\"):("\\\()\")));();();(("\\\:\\\\"));(("\\\\\\\\\()\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"));(("\\\()\\\\()\\"));();();}();}(){(){:'';'':'':;'':'':;'':'':;'':'':;'':'':;'':'':;}}'''(){;(!("")||(!&&&&("")));';(&&);();("");();();();(&&){((""))();(("")){(());;}};;()(&&''){;;(;;)(){'':'':'':;:;}();()(){'':;;'':;;'':;;};;}:(){(){;;(()){('\\'&&){(){'':'\';;'':'\';;'':;'':'\';;'':'\';;'':'\';;'':'\';;'':'\';;'':'\';;'':{;(!());;();;(()){;();}};'':;(!(''&&''));;'':'':'':'':'':'':'':'';(''&&'')('');(''&&'')('');;'\\':;::('\\');;}}();};;()('');}}{(){();;;()('');}}()('\');;}
>>
>>51560734
>There is no use in teaching kids to program, it's too abstract for them.
I disagree. What kids would need is advanced visualization tools. As I suggested just a couple of buffers and an easy interface into them would be fine. Perhaps an abstraction layer on file encoding and stuff (Basically convert every jpg/bmp/png into a plain obvious bitmap format). Then if you have an UI which shows what happens in every stage of the program the kid can easily figure it out. Presuming they're not writing things that are too complicated.

I don't think my problems were the complexity of the programs really. It was just how I had to interface with things.

And if they're actually writing something that's out of their reach then have a step by step process where they can receive live-adult intervention or something (the steps would be asking the child to check things, or have the program do it for them).
>>
>>51560881
There is no 'howto' on logic. Just keep at it.
>>
Is there a way to make exe/command line applications with python natively. So that someone else doesnt need to have python installed to use it. Theres some really old programs I made that I dont want to convert and it could be of use still. I know there are programs like pyexe but Im interested in whether theres already a way to run a python script without having python installed that python supports.
>>
>>51560844
no you don't understand, it is impossible to have a syntax error in scratch because all the coding is done with blocks that snap together, if you can't do something in the syntax of the language than the program will literally not let you snap the blocks together. that constraint is really helpful because it visually teaches about programming syntax without needing much explanation
>>
>>51560918
It's not programming. Programming is logic and math. That shit is just legos. Legos don't teach you physics.
>>
>>51560917
what'd you write it in?
and cmon man,
if (count % 80 == 0) {
putchar(10);
count = 1;
}
>>
File: 1369446960901.png (20 KB, 256x310) Image search: [Google]
1369446960901.png
20 KB, 256x310
>>51560942
>Windows doesn't even have interpreters for the most popular scripting languages
>Ever developer has to ship their own interpreter
>200 versions of python on your computer
When will the meme known as 'Windows' end?
>>
>>51560961
And how does that help with kids? That's a syntax error if I ever saw one. Hopefully there's a popup which tells you what the problem is and suggests a str() or something.

I do see how it would be incredibly hard to implement that in text-code languages though. Since the set of character inputs is much larger and interpreting intent would be a harder problem.

>>51560971
So you really think that having them explore programming isn't helpful? What I described isn't necessarily legos. It can be anything. What i was explaining was that I don't think it's the logic and math (to some extent) that trips people up. Sure, you can't expect a kid to get as far as your 40 year old software engineer but further than nothing is a good head start.
>>
>>51561010
I guess not. Ill just tell them to suck it up and install python until I convert it then.
>>
>>51560942
py2exe is something I've heard of I think. Dunno how it works or if it works well. Supposedly constructs executable files though.
>>
>>51561010
>Windows doesn't even have interpreters for the most popular scripting languages
So? Neither do Arch or Gentoo*. There's literally nothing wrong with that. Including those interpreters because a program /might/ use them is retarded and creates stupid bloat in the OS.
Anyways, they are "scripting languages" for a reason. You shouldn't be using them to write a desktop program, you should be using them to make (and possibly distribute) scripts for people with technical knowledge (in which case they would either already have the interpreter on their computer or would know how to install it).
*(unless required for compiling some program, in which case it will be installed. for example, since portage is written in python that's included)
>>
Hey /dpt/.

I've made a rudimentary gamepad to control flash games, NES emulators, etc. using an arduino uno. I couldn't initially get HID to work so I'm using my arduino sketch to output strings to the serial on event triggers, and have a Java program to monitor the serial to then make keypresses with Robot.

It lags. Slightly, but noticeably. If you're playing a game with a lot of precise button mashing, you'll see commands being executed after you press them.

Is this an issue with my method? My code? Would HID fix this?
>>
>>51561095
>Neither do Arch or Gentoo*.
Distributions especially made to be small and "unbloated"/customizable.

Windows has clearly abandoned that goal if it ever was a goal.

The solution in true windows fashion would be to recommend the user to install MS Python Interpreter for 29.99$ through the windows store (whatever it's called).
>>
>>51561095
>Neither do Arch or Gentoo
You can trivially obtain them with your package manager. Even if they're not installed by default, the distro still 'ships' them.
>You shouldn't be using them to write a desktop program
While I agree for the most part, not everyone thinks the same as you.
>>
I need some ideas for a project.
It needs to use file input / output, and hashmap / hashset.
I could do an inventory thing, but I want something that's more fun to watch.
I was thinking of making a simple path finding visualizer, or algorithm / math visualizer (showing where the derivative and integral come from and what they represent, power series, etc).
The project is meant to be a final review of java and object orientation basics.
>>
>>51561040
there is no popup, visually they don't connect and you just can't snap the blocks together. scratch has actually taught me that popups and error messages are HORRIBLE ui

also
>If you make an intermediate calculation in scratch it's just plain visible somehow?
yes, if you disconnect any block and click on it it shows you the result of the computation
>>
>>51561129

Update: It's less about the lag and more that if you make a lot of inputs in a short amount of time, it gets backed up and executes them in order after they've been triggered.

I can't tell if this is an issue that could be fixed in my code or if I need to ditch serial and move to HID entirely. HID would probably fix it but I want to make serial work!
>>
>>51561205
>scratch has actually taught me that popups and error messages are HORRIBLE ui
Yes. But what i mean with popup isn't the kind that interrupts flow. I mean the more general sense of alerting the user. What you could do is have a small "hoverbox". Like the kind you get when you hover over something in many UI systems (see pic). It wouldn't interrupt flow but it'd be immensely helpful for every kind of user, veteran user who aren't entirely sure on what kind of block they're holding and new users who don't know what's supposed to go in the slot.

>yes, if you disconnect any block and click on it it shows you the result of the computation
So variable inspection? Perhaps I'm misunderstanding the way Scratch is run.
>>
>>51561183
romanji to katakana converter
>>
Fleshing out a simple linked list in C.

LISTS ARE POWERFUL

http://pastie.org/private/k2m2iy98rq5qyynvhnabqg
>>
>>51561363
>[Update] [Auto] 10
Can you implement this in schmeme so I can memify it?
>>
>>51561370
lol why the fuck was that highlighted
>>
>>51561129
>Is this an issue with my method? My code? Would HID fix this?
It's incredibly hard to tell what the problem can be without knowing what you've done. It could be a polling issue, it could be input lag in the application you're driving (maybe the game isn't responsive to gamepads or whatever).

If you're really stuck I'd find a way to profile the code. Aka figure out the first instance where you can make a timestamp for when you've pressed a button. Then time at different places so see where the biggest time difference is. Likely your problem is there.
>>51561224
>It gets backed up and executes them in order after they've been triggered.
Well the inputs should never be "backed up". Unless that's intentional design of course.
You can try and time if your OS is too slow on the serial port but it seems unlikely that that'd be the problem. Again, hard to tell without more information.

Profile it.
>>
File: image.jpg (97 KB, 476x400) Image search: [Google]
image.jpg
97 KB, 476x400
>>51557857
Trying to make an ICBM guidance system with python
>>
>>51561493
reported
>>
>>51561493
based korea is best korea
>>
>>51560971
>it's just legos

if it's not assembly, it's lego
>>
>>51558221
A Y Y
Y Y A
Y A Y
>>
File: 1446407357663.jpg (194 KB, 1280x720) Image search: [Google]
1446407357663.jpg
194 KB, 1280x720
>>51561636
What do you want
>>
>>51558116
anyone worth their salt doesn't use python at all
>>
>>51561647
Fuck, I was about to make the same joke.
>>
>>51561651
anyone worth their vinegar only uses python
>>
>>51560689
>>51560808
>(north) murrica
>>
>>51561669
given that vinegar never had any particularly high value as a commodity, this is true.
>>
>>51561730
K E K
E K E
K E K
>>
>>
>>51561751
They must sell clothing for 'bloated' people.
>>
anyone worth their spice uses C++/D
>>
>>51561751
the hell kind of business idea is that
>Glib Man™ Quality Menswear & Accesories | Lifestyle Be glib. Be you.™ #glibmanmenswear
they actually paid for those trademarks?

maybe it's like the xbox one, the name is so retarded that people will talk about it and indirectly shill for the company
>>
>>51561834
>indirectly shilling [redacted]
>>
File: 1434229519851.png (210 KB, 871x900) Image search: [Google]
1434229519851.png
210 KB, 871x900
I'm using argp:

#include <stdio.h>
#include <argp.h>

static int parse_opt(int key, char *arg, struct argp_state *state)
{
int *arg_count = state->input;

switch (key)
{
case 'd':
printf("HurrDurr\n");
break;

case ARGP_KEY_ARG:
(*arg_count)--;
if (*arg_count >= 0)
printf(" %s", arg);
break;

case ARGP_KEY_END:
printf("\n");
if (*arg_count > 0)
argp_failure(state, 1, 0, "too few arguments");
else if (*arg_count < 0)
argp_failure(state, 1, 0, "too many arguments");
break;
}
return 0;
}

int main(int argc, char *argv[])
{
struct argp_option options[] =
{
{0, 'd', 0, 0, "Hurr"},
{0}
};
struct argp argp = {options, parse_opt, "WORD [WORD [WORD [WORD]]]"};
int arg_count = 1;
int rv = argp_parse(&argp, argc, argv, 0, 0, &arg_count);
return 0;
}


How can I set flags for the arguments?
For instance instead of
case 'd': //branch off into fucking eternity
I would rather
case 'd': flag_d = 1; break;
and then just check the flag when I need to decide what options were set.
The problem is that argp has that callback
parse_opt
with a specific set of formal parameters, so I can't pass in a struct of my own containing flags, and I can't return one because
argp_parse
expects the callback to be of type int and also return 0, otherwise error.
The only thing I can think to do is make a global struct or a set of global static variables to act as flags, but I feel like that would be stupid since the argument parsing phase of my program is by far the least significant part so it would be overkill and bad practice to make things indiscriminately visible to the entire file just because I need to access it from one specific tiny function.
What do?
>>
>>51558211
>he is literally named guido
kek, what a meme language for cs memesters
>>
>>51561893
C stands for Christian language
this is now a Christian thread

if your language doesn't have static typing, it's shit
if your language can't be compiled, it's shit

crusades when
>>
File: fixed_1.png (43 KB, 1203x640) Image search: [Google]
fixed_1.png
43 KB, 1203x640
>>51558402
Yes, yes I do. Prepare to be in psychical agony looking at my code.

https://github.com/Partinarel/map-make/tree/master
>>
What's the best C++ book for somebody who's already taken a shitty college course and wants to actually learn the language? How's Stroustrup?
>>
>>51561949
Remember the 4th crusade.
>>
>>51560419
>old language = bad language
>>
>>51561974
>book
You're doing it wrong

>online tutorials
>online videos
>cppcon / other C++ (and C++ style languages) conventions

then learn D because it's better
>>
>>51560648
>needs flash
why? why don't they rewrite it in HaXe and port it to html5 directly?
>>
>>51561974
If you took a course you probably know everything you NEED to know.

Start programming and ignore all the C++ features (except function overloading and stuff because that's convenient).
>>
File: Untitled.png (3 KB, 399x211) Image search: [Google]
Untitled.png
3 KB, 399x211
In Java Swing, what's the best way to lay out a GUI like this?
Like I want some components on one side, and another on the other side.

I had originally done a GridLayout to split the panel then a LEFT FlowLayout and a RIGHT FlowLayout, but if one side has more components then the other it starts to look weird really fast.
>>
>>51558219
literally worse than hitler
>>
So I'm now really pissed off at GCC.

With the -s flag a hello world program compiles down to an executable that's 4384 bytes. Any other optimization flag setup (-Ox or no flag at all) produces an executable that's either 6680 or 6688 bytes.

Manually writing and linking the assembly code that produces the same exact result when the program is run results in a binary that's 936 bytes.
NINE HUNDED THIRTY-SIX BYTES.

I now know that "GCC is better then you" really was just a meme because it produced code that was at BEST almost FIVE TIMES LARGER than my handwritten asm code.
>>
>>51562050
>the only metric of executable quality is its size
>>
>>51562068
It is when GCC's "optimized" flags produce grossly unoptimized code.
>>
trying to iterate over a perl script but i can't figure out how to do it.

for i in $(seq 0 10 500)
do
echo Trying $i byte offset
./a.out $(perl -e 'print "\xff\xff\xff\xff" x $i')
done


i imagine the $i in the the perl line doesn't get substituted because it's nested in another $() block, but i don't know how to get around that...
>>
>>51562068
space is more limited than time
>>
>>51562050
Use the -Os (optimize for space) flag you idiot
>>
>>51562050
>936 bytes
For Hello World? That better be a GUI program!
>>
What the fuck?
This is my code:
print n, 25
print n > 25

This is what Python tells me:
5 25
True

Are there ghosts in my code? Did mathematics get reinvented last night?
>>
>>51562050
Are you using the C standard library? I suggest not doing that if you care about executable size.
>>
>>51562017
Haxe is kinda cool but I can't help but see it as another C++ (or maybe closer to D?). It just looks like the developers found every cool language feature and then dumped them all into a single language without really considering how well the pieces will interact. The majority of the features go completely unused and then 90% of programmers can't read more than half the language. Then again, all the available backends gives it a point even if it isn't that great a language.
>>
>>51562100
If you'd read my post you'd realize that I did.
-Os resulted in a 6688 byte binary, as did -O1. -O2 and -O3 result in a 6680 byte binary.
>>
>>51562050
try writing a big program in asm. also, not all of that generated output is code...
>>
>>51562050
What are the execution times of the two programs?
>>
>>51559460
>invert last bit
>using a macro
Am I missing something here? Why not just XOR your register of 0x1?
>>
>>51562133
You said -s, not -Os
>>
>>51562050
Compile an actual application, not a hello world.
>>
>>51562127
>using the snake language
>>
>>51562127
Something is very wrong with your code. Why don't you post it in its entirety.
>>
File: dude amazon lmao.png (3 KB, 534x85) Image search: [Google]
dude amazon lmao.png
3 KB, 534x85
I really wish I knew what the fuck was going on right now.
>>
>>51562127
What's the type of n?
>>
>>51562131
haxe uses the flash API and is similar to actionscript/javascript
I don't see how your post relates to scratch, though. haxe is the easy way to port flash code to HTML5+JS/Java/C++/...
>>
>>51562140
How would I test this?

>>51562130
Yeah, that might be it. Is there a way to access stdout in C without using the standard libraries?
>>
>>51562050
Did you
#include <stdio>
? If so, why did you expect your executable to be small?
>>
>>51562143
>>Any other optimization flag setup (-Ox or no flag at all)
Learn how to read, please.
>>
>>51562179
$ time ./hello_world
>>
>>51562043
It was a terrible course, and the "interactive ebook" that we used was such a bad textbook that I still don't know how to do half the stuff in C++ that I learned how to do in C from the first 100 pages of K&R.

>>51562007
The teaching style usually used by tutorials and videos is too pragmatic. I always learn things more easily from rigorous, comprehensive texts than from "intuitive" hands-on stuff.
>>
>>51562165
>xamarin
I bet you're even using MonoDevelop.
Thread replies: 255
Thread images: 28

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

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.