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

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

Thread replies: 255
Thread images: 46
File: K&R himegoto waifux2.png (1 MB, 1000x1400) Image search: [Google]
K&R himegoto waifux2.png
1 MB, 1000x1400
old thread: >>53575640

What are you working on, /g/?
>>
first for i love all of you
>>
>>53582261
Kill yourself, you degenerate fuck.
>>
My life.
>>
can we all be nice in this thread? Programmers are notoriously edgy so a change of pace would be nice.
>>
>>53582312
fuck you
>>
Trying to fix a crash bug in C++. I can't figure out what's causing it, I think it may have something to do with a map of sound files, with strings as the key. When I run it in debug mode, the crash doesn't happen. Any ideas?
>>
>>53582358
uninitialized variable
>>
>>53582328
edgy
>>
>>53582358
how big is the codebase? maybe you could put it on pastebin / git service for help
>>
>>53582402
It's around 10 bajillion lines of code.
Weird thing is, this just started randomly happening recently. I don't even remember changing anything.
>>
>>53582416
i dont use c++ but ill try to help nonetheless

change any compiler settings?
>>
>>53582358
>>53582416
If you're using an IDE then all I can think of is that the release settings don't match the debug settings.
>>
>>53582428
Nope, I sure haven't. Haven't updated my IDE or anything. I did completely rewrite some spaghetti code, and after that is when it started happening, but when I reverted back to the spaghetti code, it continued to happen.
>>
>>53582464
Do you use version control?
>>
File: 1441749460779.jpg (36 KB, 615x345) Image search: [Google]
1441749460779.jpg
36 KB, 615x345
>>53582523
Fuck no.
>>
>>53582555
Have you tried cleaning and rebuilding everything?
>>
>>53582464
use a static analyser, or -fsanitize, or valgrind
>>
>>53582555
use TDD
>>
The monadic approach to programming, in which actions are first class values, is itself interesting,
beautiful, and modular.
>>
>>53582678
How is that any different from functions-as-first-class-values or messages-as-first-class-values ?
I suppose "hey they're all turing complete"
>>
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>

using namespace std;

int shmid;
key_t key = 123456;


struct sdata {
string firstname;
}*data;
int main(){

size_t shmsize = sizeof(struct sdata);
shmid = shmget(key, shmsize, IPC_CREAT | 0777);
data = (sdata *)shmat(shmid, 0, 0);
//data->firstname = "STRING"; WHY DOES THIS NOT WORK? Seg fault err
sleep(10);
shmdt((void *)shmid);
shmctl(shmid, IPC_RMID, NULL);
}
>>
>>53582269
<3 <3 <3
>>
>>53582862
Creating a IPC shared memory segment, why the fuck can't I access the string inside the structure and assign it to something?
>>
anime is the best >_<

are there any anime about programming
>>
>>53582968
i dunno senpai i don't even watch anime tbqh >_<
>>
File: kotB[1].png (106 KB, 600x469) Image search: [Google]
kotB[1].png
106 KB, 600x469
Last thread I asked about:
> Can anybody recommend a decent online note taking service for programming?
> I want to insert code snippets, preferably with syntax highlighting.
> Some kind of easy formatting would be great too, like Markdown or BBcode, or some custom shit, I don't care.

Anon said:
> Try one of those online org-mode services.


So I looked into it, and it looks primising. Does anyone have a goood recommendation on an online org-mode service? Does anybody use shit like this?

It does not have to be full online, tough. If I can deploy this to my own server, that's fine too.
>>
How can I average seven sizes of chars?
>>
>>53583013
return sizeof(char)
>>
File: jetbrains_250x250[1].png (16 KB, 250x250) Image search: [Google]
jetbrains_250x250[1].png
16 KB, 250x250
Reminder that CS students can use Jetbrains prodicts for free for HTML programming :-)

Jokes aside, IntelliJ is quite good, in my opinion. And it's also nice that they make DLC-s for Visual Studio too, which should have been included in the first place. Nice!
>>
>>53582968
Subete ga F ni Naru
It's not strictly about programming, but has something to do with it. It's a good thriller. Let's just say the plot revolves around a "prison" with a custom OS. Whoich malfunctions at the worst times.
>>
>>53582968

Battle Programmer Shirase.
>>
>>53582261
Stop this programming trap meme.
>>
I'm working on a full compiler for a high level language, C#/Java inspired. It'll be compiled down to an executable file, without some shitty runtime that need to be installed.

I have prototypes and proofs of concepts for all parts, so I know I CAN do it.

But I think I'm way over my head in terms of the scope. There's so much.

How do you guys motivate yourselves to write a million lines of code?
>>
>>53583267
it's not a meme anon it's reality
since I started wearing cute skirts my programming skills have increased out of sight
>>
>>53583423

>working on a compiler
Use YACC and LLVM if you don't want to write a million lines of code.

>>53583453

https://en.wikipedia.org/wiki/Placebo
>>
>>53583671
I feel like that defeats the purpose.
Anyways I already have a backend for it.

My last project was an assembler and linker.
I got the back end working fine, at least as a prototype (I only had 2 dozen x86 instructions, where I'd probably need 5 dozen).

I was able to write semi-large assembly programs that would compile and link to a portable executable.

It was a fun exercise and I want to extend it into a full language.
>>
>>53583453

is this true?
>>
>>53583671
The thing about placebos, tripfriend, is that they work ;)
>>53583758
100%
>>
>>53583758
it's a scientific fact!
>>
>>53582261

If CS50 isn't easy for someone does that make them a shit programmer?
>>
>>53583799
What's an "CS50"?

Programming is more than syntax errors and type mismatches.
>>
>>53583711

>I feel like that defeats the purpose
It doesn't really. I mean, if your goal is just to learn, then yeah, you should probably write your own parser and other components, but if you want to get a working compiler that will be easier to extend, it'd probably be a good idea to use LLVM anyways.

But as a thought, you could use your initial compiler to bootstrap another compiler written in the new language, which produces LLVM-IR and such.
>>
>>53583799
No, you just need a different way of looking at the problem, use a free online course for review. There's a ton of free online resources for learning the basics, google that shit fool.
>>
File: Screenshot_20160320_160826.png (12 KB, 226x251) Image search: [Google]
Screenshot_20160320_160826.png
12 KB, 226x251
VM works

Do I really need to support literals in the machine code for anything other than putting something into a register?
I mean like, currently all of my arithmetic operations can only take registers as operands. I feel like it's simpler, which is good, but it also means that to increment something you have to
store   rx 1
add ry rx ry

and if you don't have any registers left (there are 16) - you need to start spilling
>>
>>53583840

https://www.edx.org/course/introduction-computer-science-harvardx-cs50x
>>
installed ubuntu lads
>>
File: hi.png (35 KB, 145x145) Image search: [Google]
hi.png
35 KB, 145x145
>>53582261
id stroke her cock
>>
File: Screenshot_20160320_162204.png (2 KB, 110x27) Image search: [Google]
Screenshot_20160320_162204.png
2 KB, 110x27
>>53583862
also is there really any point having separate memory and registers if they're both literally the same?
>>
>>53583962
what vm is this for? Is it one that you've made where the spec explicitly demands having 16 registers and having them be different from the memory?
>>
>>53583862

>Do I really need to support literals in machine code for anything other than putting something into a register?

It can help to support immediate values for:

Relative jumps
Add/Subtract operations
Bit shifting

and a few other things.

But you don't REALLY need an immediate for anything other than loading into a register.
>>
>>53583977
I'm just fucking around with it honestly
the vm and assembler are combined about 250 lines of code, of which a fair chunk is lists of instructions

>>53583988
I'm probably going to write a higher level language for it soon so the compiler can deal with that desu
>>
>>53583862
You should for the sake of making the programming more compact. You should be able to do something like: "add r1, 5", but I can see why that'd be harder.

Although something like increment/decrement should be implemented at the very least. This is something that happens in every loop.

Also, I don't know which instructions you already have, but, here's some nice instructions to have:
All bitwise operations
Push/Pop - pushes and pops values off of a stack (this is just stored in memory)
Negate (neg) - negates a value
In/Out - read from a port
exchange (xchg) - swaps two values
No operation (Nop) - Does nothing
Load Effective Address (lea) - Computes memory location with offset. r_ = [x*y + z]

>>53583962
No. If you access each register via reg[regNum] then just make that mem[regNum] and reserve the first 16*4 bytes.

Also:
>8KB of RAM
I'd up that memory quite a bit. Anything larger than a trivial program would run out of memory fast.
>>
>>53582755
It's like the difference between a char and a byte
Semantically, they're the same but we like to think of them as different to help us ensure more safety
Ideally, a function and a procedure (action) should be the same in terms of generated code (except where optimized) but it lets us reason about them better to make them have different types in our code
>>
File: screenshot_00034620160319234529.png (431 KB, 642x615) Image search: [Google]
screenshot_00034620160319234529.png
431 KB, 642x615
Name one single thing that C can't do.
Protip: You can't.
>>
>>53584133
Write a program to determine whether an arbitrary turing machine will halt.
>>
>>53584133
C will never make me a happy programmer.
>>
>>53584133
Write code without boilerplate.

Why is it that every time I have to deal with a string I must call upon a hundred lines of code and several functions when any other language it would be one or two lines of code?
>>
>>53584157
Because you are clearly rewriting your string functions every time
>>
>>53584157

Well you can do that (with libraries), it's just that like in those other languages, under the hood, several hundred lines of code are going to be called.
>>
File: Screenshot_20160320_164039.png (9 KB, 224x296) Image search: [Google]
Screenshot_20160320_164039.png
9 KB, 224x296
>>53584041
yeah it would be a bit iffy
I'd have to add in separate instructions for add 2 register values and store, add a register value and a literal and store, add 2 literals and store, for every operator

I'm already having enough trouble with jumps - I'm almost certainly going to have to add jumps to locations in registers, because currently I only have jumps to literals and no 'return' instruction, so functions are kind of impossible

Here are all of the instructions - most are pretty self explanatory
having literals in the binary code means that I have to make each operation 128 bits 'wide', because they're stored as uint[4]s
if anyone knows how I can reinterpret a ushort[2] as a uint in D, that'd be greatly appreciated

>Push/Pop
I don't really have a stack
>No operation
Is that really that useful? I can't really use it to wait, because I don't actually have cycles and stuff, so it'd just shoot through it
>lea
that seems a bit complex
I was trying to keep it RISCy (mostly because I just copied 70% of MIPS from the wikipedia article)

>Anything larger than a trivial program would run out of memory fast
The vm itself is a trivial program
I don't think I'm going to be writing anything interesting on it yet
>>
File: smartneko.webm (2 MB, 720x404) Image search: [Google]
smartneko.webm
2 MB, 720x404
Ask your much beloved programming literate anything (IAMA)

>>53584133
abstraction
>>
>>53582261
Nagisa is better
>>
>>53583090
CLion is amazing too senpai. Make sure you snag that. I also can't wait untill their C# IDE comes out, then I'll finally learn the language.
>>
>>53582358
Just tried running an older version of the program, and it still happened. I've probably had this bug for a while but I've just never noticed it.
I think it has something to do with improperly handling pointers. Unfortunately, those kinds of errors are extremely hard to pinpoint. I'll just have to keep looking.
>>
>>53584230
do you know how to reinterpret a ushort[2] as a uint in D?
>>
What programmin or cs related book are you all reading currently?
>>
>>53584208
I don't know D, but couldn't you do something like:
uint i = ((uint)ushort[0] << 16 | ushort[1]);

You could swap them around depending on how you're storing the values, but that should place both ushorts together as one uint.

>Push/Pop
>I don't really have a stack
You should. If you're going to make a language on top of that, stack frames are necessary. Anyways, all it does is push a value into the next memory location. It's what you do when you've ran out of registers.

>No operation
>Is that really that useful? I can't really use it to wait, because I don't actually have cycles and stuff, so it'd just shoot through it
If you don't have cycles, then no, it isn't. But it's usually just to align the code to execute faster. If it's loaded into memory, I'd seriously recommend reading up on it and including it.

>lea
>that seems a bit complex
Sure, I guess it is. But retrieve the 4th object from a list of objects and get a member of the struct that's at the 8th byte.

I can do it with a single lea: (assuming a pointer to the list is in r1):
lea r0, [4*r1+8]

That's something that'd be at least several lines of code right now for you.
At least implement offset calculation. r'th object in a list:
offset r0, [4*r1]
>>
>>53584283
d has unions

http://www.tutorialspoint.com/d_programming/d_programming_unions.htm
>>
>>53584330
>modern language that has long, short, int, etc
Cancer
>>
>>53584208
>>53584330
Adding onto the lea/offset, you could also make it use registers, to make it more dynamic.
store r1, (location_of_array)
store r2, 4
offset r0, r1, r2
>>
>>53582261
wait a second, why is Himegoto the mascot of /dpt/? I mean her name literally contains the dreaded GOTO
>>
>>53584362
fuck off dijkstra
gotos are goatos

memes considered harmful
>>
>>53584362
>GOTO
>dreaded
not this meme again
>>
void *memchr(const void *s, int c, size_t n);

Is it undefined behavior to pass 0 as n?
If not, what will memchr return if n is 0? the man page does not specify.
>>
I'm going to write my game in Haskell without using the standard library. I want minimalism, flexibility, and sane type classes.
>>
>>53584399
there's someone in agdg creating a roguelike in Haskell, I remember it coming along pretty well
>>
>>53584405
He hasn't posted in a while...
>>
>>53584361
sure, but why not
store r1, (location of array)
store r2, 4
add r1, r2, r3 ; store in r3 - I know it's backwards
load r4, r3


all of my data is 32 bit, so I don't really have to deal with different sizes
plus I'm not dealing with caches and stuff so saving a few instructions isn't really worth the cost of increasing the complexity of the implementation imo
>>
>>53584399
hahahahaha
Thanks for the laugh
>>
>>53584397
Check the standard, this is the best man page.
It's not undefined behaviour if n is 0, however, s should be a valid pointer to an object (not NULL, not pointer to an object that you called free() on, not pointer to garbage, etc) ether way (having n = 0 will not save you).
>>
>>53584451
s is always pointing to a valid object, I only just want to know what memchr is supposed to return if s is valid and n is 0.
Also I'm not fucking paying $60 to read the C standard, fuck you.
I did read the draft though, and it was hardly different from the man page, but with careful reading I have come to the conlusion that memchr will return 0 when s is valid and n is 0.
>>
File: c8fad3dc8a.png (22 KB, 525x350) Image search: [Google]
c8fad3dc8a.png
22 KB, 525x350
Added an http request to fetch the dj image for my r/a/dio player, still looks like shit tho.
>>
>>53584543
r/a/dio as shit.
>>
File: game engine3 (1).webm (3 MB, 1280x720) Image search: [Google]
game engine3 (1).webm
3 MB, 1280x720
r8 my cross platform game engine written with C++ and OpenGL 3.3
>>
>>53584530
>Also I'm not fucking paying $60 to read the C standard, fuck you.
Kill yourself fucking faggot. The draft is literally the same as the standard except that it doesn't have the "muh ISO certified" shit.
Not to mention that you could pirate it, FUCKING FAGGOT.

>I only just want to know what memchr is supposed to return if s is valid and n is 0.
>or a null pointer if the character does not occur in the object.
>>
>>53584562
Have a bad day?
>>
>>53584577
No, instead I got a "fuck you" from a faggot that I helped.
>>
>>53584559
>3.3
y tho
>>
>>53584593
>waah someone sweared at me on the internet
>>
>>53584598
2.x is outdated, I needed framebuffers and stuff. Even Intel HD3000 supports 3.3 at core profile. So no deprecated stuff. Also you need to use 3.3 core profile or 2.1 backward profile in Mac OS.
>>
>>53582862
no error handling isn't the best way to go about it
>>
>>53584603
Not him, but only the worst type of newfags behave like this after someone helped them out.

You aren't nearly as clever as you think, and you are trying way too hard to fit in.
>>
>>53584603
It looks like you don't understand the difference between simply getting sweared on the internet, getting sweared after doing something retarded and getting sweared after you helped someone out like a fool.
>>
>>53584610
I just figured that you'd use the latest version since it's not like they're gonna release an updated one ever again.
>>
Is Eclipse still the industry standard for Android app dev or has it finally moved to Android Studio?
>>
Alternatives to pygame?
>>
>>53584647
love (lua) just learn a new language
>>
>>53584362
Oh yes, GOTOs are evil. Look through the linux kernel, and you will surely find none.
Oh wait, they're fucking everywhere because it's a tool.
We shit on bash because because hammer-nail whatever, but as bash, GOTO has its uses.
>>
>>53584647
SDL
>>
This project is fun if you've got nothing better to do:
https://github.com/ssloy/tinyrenderer/wiki

I went through about half of it in jsfiddle. Slow as balls, of course, but still fun.
>>
>>53584133
>any form of type safety
>any form of polymorphism
>operator overloading
>monads
>be latest trend on HackerNews
>>
>>53584655
Cancer
>>
>>53584647
While I dislike SFML, benchmarks typically show pySFML as being 100x faster than pygame in most cases. Use a different language for game-dev
>>
>>53582261
can someone help me understand AVL and Red Black trees? is there a good site/youtube video for the subject? THANKS
>>
File: pajeet.png (116 KB, 867x436) Image search: [Google]
pajeet.png
116 KB, 867x436
>>53584712
Wikipedia

>Video
Pajeet
>>
File: Screenshot_20160320_182936.png (17 KB, 319x360) Image search: [Google]
Screenshot_20160320_182936.png
17 KB, 319x360
added a stack, as well as call and return

made my assembler completely ignore any whitespace that isn't a newline, so I can indent shit now

this is pretty much the most fun I've had programming for a long time
>>
File: 1424055625jekyll.png (30 KB, 573x254) Image search: [Google]
1424055625jekyll.png
30 KB, 573x254
Trying to use jekyll and host in github ( for my portfolio) , any advice?
>>
is open source?
>>
>>53585078

That is not a question. Try one of these:

>Is ___ open source?
>Is open source ___?
>What is open source?

Where ___ may be replaced with pretty much whatever, as long as it makes sense in context.
>>
>>53585270
He was clearly asking if the empty string is open source,
>>
File: 1458059805521.jpg (111 KB, 478x640) Image search: [Google]
1458059805521.jpg
111 KB, 478x640
To those enlightened to the Postscript way: Do DSC nest? Will I be able to get away with blindly splitting postscript files at DSC comments and not fuck everything up?
>>
>>53583758
You can't be that naive. No one is.
>>
>>53585397
oh

in which case, no, the empty string is proprietary because it's licensed under the license
>>
Why does C require the -> operator to access members of a pointer to struct?
Is C not smart enough to figure out wether it needs to deref something or not when using the . operator?
Correct me if I'm wrong, but everytime the -> op is used, the object being accessed is always of type pointer, and every time the . op is used, the object being accessed is always of non pointer type.
Surely the compiler can simply merge the two operators and figure out wether it needs to deref based on the type of the object being accessed.
>>
>>53585482
Don't confuse types with pointers.
They are widely different things and should be treated as such
>>
File: Blue_Station_920_632_80.jpg (133 KB, 920x632) Image search: [Google]
Blue_Station_920_632_80.jpg
133 KB, 920x632
>>53585078
>>53585397
>>53585473
AT&T owns the copyrights to empty strings. See the true utility fiasco[1].

[1]: http://trillian.mit.edu/~jc/humor/ATT_Copyright_true.html
>>
>>53585482
>Why does C require the -> operator to access members of a pointer to struct
it's short for (*structpointer).member
>Is C not smart enough
believe it's due to some low level technicality but I forget
>Surely the compiler can simply merge the two operators
It probably could, based on the fact that D does exactly what you described, but that would break legacy C code
>>
>>53585421

Guys, I posted a question I really need help with and I even included a pic related to the thread's primary subject matter.

Pls hlp if u can. pls.
>>
>>53585482
It is only there for historical reasons, back when the standard treated them differently. Not keeping it the way it is would break legacy code, as the other anon pointed out
>>
>>53585522
You're not entitled to an answer and you posted a meme picture, in any case, read the specs:
https://partners.adobe.com/public/developer/en/ps/5001.DSC_Spec.pdf
>>
>>53585534
How did the standard treat them differently?
>>
>>53585482
>Is C not smart enough to figure out wether it needs to deref something or not when using the . operator?
Sadly yes.

>>53585511
>but that would break legacy C code
They could make -> to be the same as .
>>
What happens if someone releases some piece of code under some license, and then another person happens to write exactly the same code and release it under another?
>>
>>53585573
no no no anon
ANY change to the standard of that language is guaranteed to break someone's code
I would literally bet my life that at least one person's code would break
>>
>>53585511
>but that would break legacy C code
You don't compile legacy code with newer standard versions anyway, so if that's been added in a new standard, I don't see any harm here.
>>
>>53585544
Thank you based senpai. I've already read the spec and forgot half of it. I was hoping someone would spare me the reread.
>>
>>53585592
sadly this is probably true.
But what sick fuck would use the -> op on a non pointer type? or the other way around?
They fucking deserve what they get, let their code break.
>>
>>53585570
struct vars used to be global, and used to represent offsets

you could use dot operator on any rvalue, and it would add the offset to that rvalue and represent an address. Also, you could use struct vars from other structs as they are just offsets

the arrow operator made the distinction that you were explicitly referring to that particular struct's variables
>>
>>53585592
>>53585607
Wrong
>>
>>53585482
>>53585573
There has always been a pretty strong distinction between pointers and other types in C, so they don't make it the same operator. Also, the C standard panders to the implementers, making it simpler for them.
These days, compilers can easily deal with overloading shit like that, but C was designed when compilers were much simpler, and there is no compelling reason to change how it is now.
>>
>>53585617
Would you want to put any money on that?
>>
>>53585617
nice argument fag
>>
>>53585628
Just like C99 allowing you to declare variables anywhere in the block broke lots of ANSI C code, right?
>>
Why is it that when i put a++ and do
System.out.print(x.aad(4));
I get 4 but when i do ++a it gives me 5??

public int aad(int a){
int sum = ++a;
return sum;
}
>>
>>53585628
Yes

>>53585630
Thanks
>>
>>53585650
gee I wonder why there's a difference in different operators
>>
>>53585642
Offtopic: While this did not broke anything and -> being the same as . would not break anything, the // comments DID break some code
a //* different result in C99 and C90 */
+b
>>
>>53585657
huh? when its all said and done the return sum; should just grab it all up and return it with 5, but when it is a++ it just only grabs a...?
>>
>>53585694
I mean I know that your adding before the integer with ++a but still
>>
>>53585650
>>53585694
Prefix ++ and postfix ++ work differently.
'++a' will return increment it, and return the value. 'a++' will use the value, and will increment it afterwards.
int a = 5;
System.out.println(++a); // prints 6
// a is 6


int a = 5;
System.out.println(++a); // prints 5
// a is 6
>>
>>53585670
No one fucking does that.
>>
>>53585720
is this only java, just why
>>
>>53585797
>java
lmao
>>
>>53585797
>>53585720
Damn, 10 minutes later, I realised the got the operator around the wrong way in the second example.
Anyway, every C-like language does this.
>>
>>53585727
I do
>>
>>53585797
This is literally every programming language.
>>
>>53585834
Kill yourself.
>>
>>53585873
I'm too scared.
>>
>>53585873
I'm too precious for the world to do that.
>>
    flds s6, [sp, #8]  @ Num
flds s8, [sp, #12] @ Denom
fuitod d14, s6 @ always seems to wrote 0E+0?
fuitod d15, s8 @ always seems to wrote 0E+0?


help
arm btw.

it loads the integers properly but converting the integer to a double seems to just put 0E+0 always.
>>
>>53585957
wrong destinatino register maybe?
>>
>>53585987
using armsim btw. The code seems completely legal but it just wont work properly.
something as simple as

    mov r0, #0xFF
fmsr s4, r0
fuitod d0, s4


still makes it 0E+0
>>
>>53586008
seems to work if I make it a signed integer conversion?(fsitod)
>>
>>53582261
How can I execute code independently of user requests in php?
I want make something like quassel, except over http
>>
>>53585421

Postscript documents nest. See the section on parsing rules.
>>
File: prog_books.jpg (438 KB, 900x2134) Image search: [Google]
prog_books.jpg
438 KB, 900x2134
I want to pick up the compilers book from pic related and try to make a compiler for a small language. What background knowledge should I have/what other books should I read? I completed my computer organisation course.
>>
>>53586463
First read SICP and make a lisp interpreter (last chapters). It will help you very much before moving to the dragon book.
>>
TypeScript is pcomfy tbhq.

function fizzBuzz(n: number):string {
var value: string = '';

if (n % 15 === 0) {
value = 'FizzBuzz';
} else if (n % 5 === 0) {
value = 'Buzz';
} else if (n % 3 === 0) {
value = 'Fizz';
} else {
value = n.toString();
}

return value;
}

for (var i:number = 1; i < 1000; i++) {
console.log(fizzBuzz(i));
}
>>
>>53583012
I'm interested too... Anyone?
>>
>>53584281
>>53582358
try valgrind
>>
File: ss (2016-03-20 at 12.44.44).png (20 KB, 529x598) Image search: [Google]
ss (2016-03-20 at 12.44.44).png
20 KB, 529x598
Haskell mustard race.
>>
>>53586630
Doesn't need to, it's obviously an issue with unitilialized memory and he was just lucky it didn't happen before (because the garbage memory apparead to be valid at random).
>>
>>53586678
haskell is literally unreadable if you don't fucking declare the types for your functions
>>
>>53586733
so? valgrind will tell you what you didn't properly initialize, even if it is dynamically allocated memory.
>>
>>53586678
for (uint64_t i = 0; i < UINT64_MAX; i++)
fputs("ha ", stdout);

puts("kill yourself.");
>>
File: 1458323447166.png (97 KB, 200x337) Image search: [Google]
1458323447166.png
97 KB, 200x337
>>53586745
>C is literally unreadable if you don't know any C-like language
That's how retarded you sound.
>>
File: screen-shot-2016-03-20-at-03[1].png (774 KB, 1782x1403) Image search: [Google]
screen-shot-2016-03-20-at-03[1].png
774 KB, 1782x1403
wut
>>
>>53586841
>47gb for an IDE
Wincucks will defend this.
2.7mb Vim masterrace here.
>>
>>53583711
I want to do this but have no idea how.
>>
>>53584145
A C control software for your robot could make you happy, anon.
>>
>>53586333
Unless you control the PHP configuration on the server, you can't. Most have limits on script runtime.

Use a real language and a VPS or "Cloud" container.
>>
>>53586562
Literally Pascal for the web.
>>
>>53586678
beyond disgusting
>>
File: 1388809526036.png (109 KB, 688x1434) Image search: [Google]
1388809526036.png
109 KB, 688x1434
>>53587662
>>
>>53587704
LITERALLY
>a sub-105 IQ trap faggot who uses it to delude himself into thinking he's smart
>>
haskell is fucking shit there is no compelling reason to use it other than if you're a sub-105 IQ trap faggot who uses it to delude himself into thinking he's smart
>>
At what stage should I move from python to C or C++? C or C++?
>>
File: sour grapes 7.gif (10 KB, 640x918) Image search: [Google]
sour grapes 7.gif
10 KB, 640x918
>>53587727
keep crying bae
>>
>>53587742
C++. as soon as possible

>>53587753
stay delusional, FAG
>>
>>53587742
When you turn 18.
So you've still got about 6 years ahead of you.
>>
File: sour grapes 6.jpg (38 KB, 541x700) Image search: [Google]
sour grapes 6.jpg
38 KB, 541x700
>>53587760
your tears are delicious
>>
>>53587767
you are NOT smart for using haskell and the reason why >99% of programmers choose NOT to use haskell isn't because they are unable to use it
>>
>>53587704
>>53587753
>>53587767
Fuck off you underage memer.
>>
File: sour grapes 2.jpg (14 KB, 300x250) Image search: [Google]
sour grapes 2.jpg
14 KB, 300x250
>>53587786
>>
>>53587791
keep believing that, FAG
>>
File: stupidshittyness.png (119 KB, 1145x806) Image search: [Google]
stupidshittyness.png
119 KB, 1145x806
javascript homework :/
>>
>>53587760
> C++
Why
>>
File: sure m8.gif (2 MB, 800x459) Image search: [Google]
sure m8.gif
2 MB, 800x459
>>53587790
>being this butthurt
>>
>>53587803
You need to be of at least 18 years of age to post here.
>>
>>53587805
because python and C are shit. C++ and java are actually useful for real-world software applications
>>
>>53587813
you need to have an iq higher than your dick length to be original
>>
>>53587807
Kill yourself.
>>
>>53587801
You're hilarious
>>
File: sour grapes 3.jpg (194 KB, 636x880) Image search: [Google]
sour grapes 3.jpg
194 KB, 636x880
>>53587825
>>53587801
>>
>>53587837
DELUDED SPERG HASKELEL TRAP FAG ON SUICIDE WATCH
>>
File: sour grapes 5.jpg (66 KB, 338x450) Image search: [Google]
sour grapes 5.jpg
66 KB, 338x450
>>53587844
>>
File: butthurt (1).jpg (44 KB, 552x377) Image search: [Google]
butthurt (1).jpg
44 KB, 552x377
>>53587863
keep replying
>>
>>53587844
I have no desire to commit suicide, and my childhood 'autism' was cured by my parents giving me a good hiding. We don't coddle that sort of acting out in children in this country.

I shall not contest the remainder of your accusations.
>>
File: 1428289360271.jpg (444 KB, 636x880) Image search: [Google]
1428289360271.jpg
444 KB, 636x880
>>53587837
>>
Added a few new items to a program's configuration file and voilà: the program is now portable, you can "install" it by just copying its files to any directory you want. You just have to tell it where its resources are located (a directory) and where it can save/load its files from (also a directory). Plus a command line argument that tells it where the configuration file is located if it's not in the same directory with the executable.

I don't understand why people do this so rarely, instead they create complex installation programs and all that crap. Yes, some programs want to associate certain files with them, but even that can be made optional.
>>
File: 1437685883850.jpg (446 KB, 636x880) Image search: [Google]
1437685883850.jpg
446 KB, 636x880
>>53587885
>>
>>53587704
Haskell is gross though. I wish it was better, but

>abbreviations everywhere
>individually import literally everything you use or be deemed unidiomatic
>put type annotations on every top-level thing or be whined at by hlint
>have to give record types verbose field names to avoid name collisions
>conventions push you to use Either String a everywhere instead of throwing exceptions
>laziness leads to unpredictability and space leaks
>have to choose between declaration and expression style because fuck consistency

The ideas are interesting, but the implementation is a train wreck.
>>
>>53587803
> Not Oblivion
I approve your choice of text editor, but not your choice of theme or spacing.

There. I said it.
>>
>>53587885
>>53587951
zozzle at asop
>>
File: haskelel.jpg (102 KB, 529x598) Image search: [Google]
haskelel.jpg
102 KB, 529x598
>>
>>53587803
>nested ternaries

NO
>>
File: haskelel.jpg (99 KB, 529x598) Image search: [Google]
haskelel.jpg
99 KB, 529x598
>>
File: 30_03_14_by_sanchiko-d7c8tdf.jpg (374 KB, 1600x848) Image search: [Google]
30_03_14_by_sanchiko-d7c8tdf.jpg
374 KB, 1600x848
Never got an answer yesterday, so posting again. >>53577768

I'm looking for a type of software that I'm not sure exists, but I'd like to write. Just wondering if you guys had heard of anything similar.

I want a workflow monitoring tool. The usecase is that I'm at a large organization and every team has their own processes that we have to manage and make sure functions as expected. Every server would have a heartbeat for statuses and hooks in specific processes to know that it was kicked off or that it has finished. Ideally it'd be decentralized so every node could have the same configs that propagate as nodes are added/removed. Ex: Let's say we have two pipelines, one for ops and one for devs

OPS: build server -> configure server -> start services
DEV: source control -> build -> deploy -> start services

The tool could handle both by checking that the executables are either running/completed/not started yet, whether that's bash/ruby/python/etc.

This is not meant to be cluster management or orchestration, just lightweight monitoring. Also I just want the senpais at Hashicorp to notice me.
>>
>>53588043
>>53587987
give a rest mate
>>
File: 1454435411651.jpg (53 KB, 907x718) Image search: [Google]
1454435411651.jpg
53 KB, 907x718
>>53587963
Great critique, only if at least half of it were true.

>>53587885
>>53587951
>>53587987
>>53588043
etc.
>putting this much effort into something you don't like
You guys have way too much free time on your hands.
>>
>>53588067
He hates that which he does not understand.

If he used Haskell, he would d probably be the sort of person who would want to ban mtl and force everyone to use extensible effects instead regardless of their shortcomings.
>>
>>53588076
>open green is my pepper
>copy paste image
>new layer
>copy paste another image
>set opacity
>this much effort
yeah to a hasklelTARD it would take much effort to accomplish

>>53588086
stay delusional
>>
>http://www.tiobe.com/tiobe_index?page=index
>haskell
>0.298%
gee i wonder why, maybe because it's SHIT
>>
>>53588146
>http://www.tiobe.com/tiobe_index?page=index
Gee /g/, if we're going by the TIOBE popularity contest then I guess anything except Java is shit, amirite?
>>
>>53588146
If ratings mattered why is Java #1?
>>
>>53588173
>>53588175
epic fucking meme, java is genuinely good, fucking fedora tipping HIPSTER FAGs, enjoy your fucking haskelel LMFAO, >>53586678 isn't even written in "muh functional" style lmfao kill yourselves you have no clue what you're doing
>>
>>53588188
everything you don't agree with is a meme.
>>
>>53588224
even such a thing like specifying types is widely agreed among competent programmers to be a good thing, i'm not the only one to think that
>>
>>53588188
Why do you get so bent out of shape over this?

Or is this really a cry for a trap to fuck you in the ass?
>>
Continuing work on my chess engine.

Currently trying to debug my move generation functions.
>>
>>53588350
Noice.
>>
Hi guys I'm new here and i want to learn Java for android development. I know some basic C++ and know some advanced Java concepts. How do i go about learning? My goal is to make an app for android.
>>
>>53588350
Are you going to use UCI or Xboard? If you want to implement UCI, read the spec now. You're going to have to change a million things if you wait until you're done.
>>
>>53584133
average 2 ints without branching
>>
>>53585593
>You don't compile legacy code with newer standard versions anyway
You do.
>>
>>53588473
I was planning on using UCI. Thanks for the heads up, I'll look into the spec ASAP.
>>
>>53588444
Step 1: Gain reasonable proficiency with Java. "Absolute Java" is an okay textbook for this.

Step 2: Read "Android Programming: The Big Nerd Ranch Guide".
>>
>>53588473
Oh, somebody else who has done this. How strong was your engine?
>>
>>53588251
There are types specified on >>53586678 just for the record. Also, what's your definition of a competent programmer?
>>
>>53588444
probably this: >>53588568

and read the official android documentation
>>
>>53583090
I refuse to work in anything but vim or intellij. god i hate eclipse.
>>
>>53588568
>>53588664
Got it, thanks.
Any online resources? Or are the books my best bet?
>>
File: 1455625032913.png (166 KB, 315x284) Image search: [Google]
1455625032913.png
166 KB, 315x284
>>53587981
whatever you say, brah
>>
Does anyone here works with Android development and unit/integration testing?
I really wanted to ask you about something that's driving me mad.
>>
>>53587992
may i ask how you write them?
>>
does anyone have knowledge or know a place with knowledge in how text to speach processing works or how to modify already existing speach sound packs.
>>
>>53588707
https://docs.oracle.com/javase/tutorial/
http://developer.android.com/develop/index.html
>>
>>53588733
Use if statements, don't nest ternaries.
>>
>>53588626
It was alright although I didn't put much work into the agent. I was really just going for PGN replay.

I wrote a PGN parser and had the engine just validity of moves. Then stored the games in a SQL database and wrote a client to step through the games.

So the way it worked I would run a search(e.g. Fischer) and then select a game (e.g. Fischer vs. Spassky), then just step through moves until a position I want to play and tell the agent to begin playing as white/black. It was easier than fucking around with FEN strings and stuff.

I stopped working on it a while back while trying to implement the interface protocols, before then it was just printing SAN and my UI was a physical chess board.
>>
>>53588444
Why do you want to waste your lfie miserably making apps?
>>
File: 1455603347085.gif (445 KB, 250x188) Image search: [Google]
1455603347085.gif
445 KB, 250x188
>>53588828
but ternaries work?

If its an issue of readability i could understand using if statements, but if I can use less line of code to do the same thing why wouldn't I?
>>
>>53588870
Ignore him, he is a shitter. Generally when you can use them they are better.
>>
>>53588870
>If its an issue of readability
Yes
Mind you it really only matters when colaborating with other people
Also that less lines of code thing is bullshit.
>>
>>53582862
perhaps its an issue with shmsize?
>>
>>53588899
It's very readable, fag.
More readable than multiple assignments that if requires.

>>53587803
Is pay a global variable? Generally avoid globals.
If it is not you can just put the expression in return instead of assigning it to pay.
>>
File: 1442530289935.png (563 KB, 569x802) Image search: [Google]
1442530289935.png
563 KB, 569x802
Hey /dpt/ how do you for?
for (int i = 0; i < 11; ++i) {
}

or
for (int i = 0; i <= 10; ++i) {
}
?
>>
>>53588921
>It's very readable, fag.
It's not readable at a glance, stupid. People will hate you if you bring that kind of shit code at work.
>>
File: workshot.png (71 KB, 1535x682) Image search: [Google]
workshot.png
71 KB, 1535x682
>>53588921
Forgot i could even do that. Thanks anon.

My real issue with the code is that my teacher wants us to use objects to pull the payrate values from the URL using GET. Im still getting use to objects so I have no idea if im doing it right.

pic is results i got so far
>>
>>53588956
11 master race
>>
>>53588956
for (short i = 0; i < 10; i++){
};
>>
Can rust prove in compile time bounds checking?
And when I mean in compile time I mean refusing to compile unless it's 100% sure that the program will not try to access outside of it.
>>
Would you date Himegoto?
>>
>>53588956
The first option 100%. Use half-open intervals whenever possible.
>>
File: Nagisa-CTMCP.jpg (56 KB, 407x228) Image search: [Google]
Nagisa-CTMCP.jpg
56 KB, 407x228
>>53589001
Yes but I like Nagisa more. Unlike Himegoto he is a computer scientist.
>>
>>53588956
for(int i=0; i <=10; i++) 
{
....
}
[\code]
Thread replies: 255
Thread images: 46

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.