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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 322
Thread images: 36

File: IntelCodeTablePreview-1.gif (175KB, 1283x1800px) Image search: [Google]
IntelCodeTablePreview-1.gif
175KB, 1283x1800px
x86 Assembly edition

Old thread
>>58725218

High-level losers, take your abstractions and get out
>>
Thank you for not using an anime image.
>>
>thread stays empty lol
>>
Thank you for not posting an animu picture.
>>
>>58729135
Working on BasicTV's statistics engine for network data requests, and it's getting pretty heavy-duty

I'm also working on a ToxBot for that podcast idea, but the Pi i'm using is pretty slow
>>
File: OOP? more like POOP.png (12KB, 767x360px) Image search: [Google]
OOP? more like POOP.png
12KB, 767x360px
OOP? More like POOP!
>>
rewriting haskell in C#
>>
just rendered 3000+ objects with collision detection at 60fps. What have you done today Anon?
>>
>>58729135

you're telling me that modern assembly is still like the 8080?
>>
File: 1473403519015.jpg (219KB, 767x1340px) Image search: [Google]
1473403519015.jpg
219KB, 767x1340px
>>58729187
People
Order
Our
Programming?
>>
>>58729187
Image is retarded because there's no description of what x is or why it would be unsafe to assign it directly. It's not criticizing OOP, it's just criticizing a retarded, arbitrary use of OOP.
>>
is there a takeWhile equivalent in common lisp?
>>
>>58729229
How many of those 3000 were moving at the same time and how dense was the population?
>>
File: 1477079857756.png (362KB, 700x700px) Image search: [Google]
1477079857756.png
362KB, 700x700px
>>58729273
>Image is retarded because there's no description of what x is or why it would be unsafe to assign it directly. It's not criticizing OOP, it's just criticizing a retarded, arbitrary use of OOP.
it doesnt matter what x is for you idiot
>>
>>58729135
any other bios/uefi devs on /g/? i always feel so lonely here...
>>
>>58729285
It does matter.
>>
>>58729285
Where has your reading comprehension gone? If x is unsafe to assign for then your image is false. At the moment it's a shitty strawman that would never be seen in reality.
>>
>>58729187

>cherrypicking this hard

You can write the C code as C# and it still compiles you imbecile
>>
Finally finished dockerizing an app for my teache, hopefully tomorrow I'll be back to programming
>>
>>58729229
>What have you done today Anon?
I was writing some 'idiomatic' C++ code to make a snarky reply to an anon in the previous thread, but then I got bored.
God damn, it's a fucking terrible language.
>>
>>58729438
:^)
>>
>>58729276
1000 moving, 2000 static, encapsulated in (-30,-30) to (30,30) rectangle
>>
Does PHP 7 has a way to write this shorter?
$x = isset($someArray['key']) ? $someArray['key'] : null;
>>
Was going to make a macro in racket lisp that optimizes out intermediate lists in comprehensions, e.g.
(fusion
(foldl + 0 (map sqr (range 1 5))))
; expands to roughly
(let iterate ([i 1] [acc 0])
(if (= i 5) acc
(iterate (add1 i)
(+ (sqr i) acc))))
>>
>>58729764
$x = $someArray['key']

x will get null, but you'll also get an error in your log.
>>
File: languages3.png (17KB, 522x384px) Image search: [Google]
languages3.png
17KB, 522x384px
Reminder
>>
>>58729863
Stupid people will dispute this.
>>
>>58729285
you know there's cases in C where programmers use hidden structs or typedefs so as not to have the client rely on implementation details and instead use an interface that doesn't change. Usually used for crossplatform stuff. encapsulation isn't an OOP thing and isn't what OOP is about.

There are many bad things with OOP, but this one isn't one of them.
>>
Should I learn racket or common lisp?
>>
File: TOX.png (18KB, 1358x522px) Image search: [Google]
TOX.png
18KB, 1358x522px
>>58729180
I set up the ToxBot groupchat, but I won't be releasing the ID until tomorrow.
>>
>>58730022
>isn't what OOP is about
Actually, OOP is all about encapsulation.
That's kind of the whole reason it exists: to try and encapsulate shared state.
Too bad it fails at that poorly.
>>
>>58730045
>Too bad it fails at that poorly.

???
>>
>>58730022
https://www.kernel.org/doc/html/latest/process/coding-style.html?highlight=style#typedefs

>Note
>Opaqueness and accessor functions are not good in themselves. The reason we have them for things like pte_t etc. is that there really is absolutely zero portably accessible information there.
>>
>>58730066
https://www.youtube.com/watch?v=QM1iUe6IofM
>>
File: 1485288456168.jpg (735KB, 1200x1850px) Image search: [Google]
1485288456168.jpg
735KB, 1200x1850px
Is a for loop considered a function? Asking for a friend.
>>
>>58730166
No
>>
>>58730166
It's a statement you fat nerd
>>
File: defecate_on_my_face.png (31KB, 782x204px) Image search: [Google]
defecate_on_my_face.png
31KB, 782x204px
Guess who has two thumbs and is never touching Rust again?
>>
>>58730029
racket
common lisp is ugly and confusing
>>
>>58730174
>his language doesn't have for loops as expressions
>>
>>58730177
>scheme
enjoy having to do EVERYTHING from scratch
>>
>>58730045
If it's all about encapsulation then there's no reason for it to exist since encapsulation already exist.

There's a billion elements to OOP, it's a bloated paradigm reflected in the programs pajeet writes. criticizing OOP over encapsulation would be like criticizing haskell cause it has polymorphism.
>>
>>58730176
holy shit they have a different political opinion

fuck them and their language, i hope they get gassed or hanged at rope day

bar muslims from coming and genocide the ones that are here
>>
>>58730198
???
Racket is batteries included, and isn't even considered a scheme
It has lots of cool features famalam
Some neat Racket gems you might not know about:
>pattern matching
>parameters
>for loops
>generics
>advanced object orientation
>channels and threads
>>
File: 1458356021053.jpg (31KB, 572x563px) Image search: [Google]
1458356021053.jpg
31KB, 572x563px
>>58730227
Their using the language as a platform to push their political opinion, you dumb tit. That's the issue. This is not the first time they've virtue signaled, either. It's completely unprofessional.

Nice strawman, though. Steve is that you?
>>
Guys. I don't like using var unless I need to because I like it being clear what container is supposed to be used.
>>
>>58730152
This guy sounds like his only knowledge of OOP is from some anti-OOP professor and that he has no experience actually programming in it.
>>
>>58730265
They're. Fuck me, this is why I need to proof-read before I post.
>>
>>58730276
hello rajesh
>>
>>58730265
what happens if you use the language but don't share the same ideas as them, does the compiler shut off on you or something?
>>
>>58730304
You have to interface with those who use the language. I really don't want to program with a bunch of politically motivated ruby faggots.

Keep shilling, though.
>>
>>58730303
You still haven't provided any reason why you're against encapsulation.
>>
Working on reverse engineering a huge Java library in order to reverse engineer an encrypted, binary file format it reads.

This is the first time I've used Eclipse since 2009. I can't believe how bad it still is. I've spent more time unsuccessfully Googling all the issues I've had trying to setup OSGi and making it work, than I've spent writing actual code. Not to mention they package an old dinosaur version of the JRE, probably because every new version of the JRE breaks something else, which says a lot about the whole pile of ass language.

In short, fuck Java. If you use this shit, I am so sorry.
>>
I've never seen a convincing argument that OOP is even good in the first place.
>>
>>58730325
im not
i just memed

im against enforcing it too much, like in java
seems excessive
>>
>>58730304
The error messages and documentation are still written by them. You're still reading their words.
>>
>>58730304
The idea of capitalism and the free market is if you have a problem with something the developer or retailer is doing you just don't use the product anymore.

If they're shitters and it really bothers you then don't use their product. If you continue to use their product then you obviously don't actually care.
>>
>>58730324
You do? When I use Rust I can just get the libraries and program on my own without needing to talk to anyone.

Do you find this issue with GNU as well? Stallman has a lot of hot opinions on politics you know, so I'm curious if you get locked out of using GNU utils or something.
>>
>>58730339
Try IntelliJ IDEA.
>>
>>58730353
GNU software is a pretty small niche, I don't think I've ever met anyone who uses it.
>>
>>58730228
>"""""advanced""""" object orientation
no thanks
>>
>>58730353
>Do you find this issue with GNU as well?
Absolutely.
I don't use GNU shite
>>
>>58730353
> When I use Rust I can just get the libraries and program on my own without needing to talk to anyone.

So in other words, your programs are useless and nobody but you uses them. Okay.

>Do you find this issue with GNU as well?

GNU exists FOR those political reasons. I don't remember social justice as a feature of Rust.
>>
>>58730371
What you've never met a single emacs user or user of a GNU/Linux distribution? Or do the Linux users you know avoid the majority of the GNU software packages? Do you not know a user of GNUCash, or any of GCC?
>>
>>58730359
Does it work with this goofy Equinox/OSGi garbage? The actual coding in Eclipse isn't the worst, I'm mostly irked because I had to figure it all out myself, all the issues I tried googling got me nothing.
>>
File: bg_head_middle.jpg (93KB, 900x150px) Image search: [Google]
bg_head_middle.jpg
93KB, 900x150px
FreeVMS is looking for developers. FreeVMS (VSM stands for "virtual memory system") is a real-time operative system with tight integration with the base system, and also perfect for routers.

Support for FreeVMS is welcome!
Main page http://www.freevms.net/
Github mirror https://github.com/ztmr/FreeVMS
>>
>>58730409
I've literally never met a Linux user.
>>
>>58730425
I have. I don't recommend it.
>>
>>58730371
Like GCC, make, ld, emacs, etc?

>>58730402
>So in other words, your programs are useless and nobody but you uses them. Okay.
This doesn't follow, I said I don't have to interact with other Rust programmers in order to program in Rust, I have no idea what your statement here means.

>GNU exists FOR those political reasons. I don't remember social justice as a feature of Rust.
oh ok it's fine if one organization does it but not the other.
>>
>>58730304
I've never tried it but judging by observation of the user base it turns you in to transgender diaper furry. My guess is this functionality is in the garbage collector because that's something that doesn't have any purpose in a systems language anyway. It's the perfect place for it.
>>
File: martin-shkreli.png (251KB, 500x375px) Image search: [Google]
martin-shkreli.png
251KB, 500x375px
>>58730425
>>58730428
>when you're the Linux fag in class and know you're probably pissing someone off just by existing
>>
>>58730442
Why do they even call it a systems language when it has a garbage collector? Did they learn a single thing from Go?
>>
>>58730440
He is trolling.

Stop speaking to trolls.
>>
>>58730340
Where is your code?
>>
>>58730442
>>58730452
Rust doesn't have a garbage collector it uses RAII like in sepples.
>>
>>58730425
That's suprising, you must not go outside much. My neighbour is a Linux user and we had an interesting discussion about how much we hate arch users the other day. Though he's a JS/web app fag himself.
>>
>>58730452
Rust doesn't have a GC.
>>
>>58730452
It's not a garbage collector.
It doesn't have a memory allocator, but a memory borrower.

I tried using Rust but was too annoyed by the 'lifetimes'

C is easier honestly
>>
>>58730457
It's hard to tell the difference between trolls and rust users.
>>
>>58730440
If you aren't one of them why are you supporting their product? Fork it and make it explicitly non-SJW if you like it so much.
>>
File: WhenTheSunSets.jpg (60KB, 620x400px) Image search: [Google]
WhenTheSunSets.jpg
60KB, 620x400px
>>58729254
>>
>>58730442
I must object to your characterization of Rust users. I've been using Rust for just over a year and I have no desire to wear a diaper.
>>
File: 1481137975121.jpg (145KB, 800x642px) Image search: [Google]
1481137975121.jpg
145KB, 800x642px
>>58730477
>2017
>using memory
>>
>>58730490
When the Sun Hits?
https://www.youtube.com/watch?v=2INLBsRYVBs
>>
File: 65019882.jpg (52KB, 250x250px) Image search: [Google]
65019882.jpg
52KB, 250x250px
>>58730420
nice
>>
>>58730502
explain anime poster what is this supposed ot mean
>>
>>58730465
>>58730469
>>58730477
>It doesn't have a memory allocator, but a memory borrower.
Because "allocating" isn't politically correct. Got it.

Wait, how can it be a safe language if it uses manual memory management? Can't you just dealloc a pointer?
>>
>>58730502
>2017
>being a sissy faggot
>>
>>58730440
>GNU exists FOR those political reasons.
GNU doesn't exist for all of Stallman's political idea just the ones surrounding the 4 freedoms. In fact the GPL prevents people from using GPLed code in projects that don't want to allow the end user to use it to remove kebab. This is comforting to cis scum like me.
>>
>>58730516
>Can't you just dealloc a pointer?

Not unless you can statically prove that it's safe to do so.
>>
File: 1474325315193.jpg (44KB, 636x616px) Image search: [Google]
1474325315193.jpg
44KB, 636x616px
Employed Haskell programmer reporting in
>>
File: 1459266558171.png (228KB, 400x514px) Image search: [Google]
1459266558171.png
228KB, 400x514px
>>58730512
it's supposed to make fun of you for using memory in the year 2017
>>58730524
explain non-anime poster what is this supposed ot mean
>>
>>58730535
Tell us about your job anon.
>>
File: images.png (17KB, 350x338px) Image search: [Google]
images.png
17KB, 350x338px
>>58729306

Poor anon. I feel this.
>>
>>58730516
Yes, if you choose to eschew its safe memory-handling features (much like using raw pointers instead of references and smart pointers in C++), you can write unsafe code and do all sorts of nasty things. The point of the language is to enable you to avoid doing that for the vast majority of problems by providing powerful, safe abstractions.
>>
>>58730535
Who pays you? The department of labor?
>>
>>58730543
>images.png
Yeah, i feel your redditry too
>>
>>58730547
>powerful, safe abstractions

Nice read, Steve.
>>
>>58730551
No, the department of defense.
>>
>>58730547
This just sounds like a bullshit salespitch about how it can be all things to all people.

Is it safe or unsafe? Just tell us.
>>
>>58730539
take my big fat programming cock in your mouth then
>>
>>58730539
It means using images of cute anime girls as reaction images/avatars makes it look like you wish you were a cute anime girl who got to wear cute clothes and kiss all the boys!
>>
>>58730586
i'm not the girl on that image though!
>>
>>58730387
Yeah, I never find myself actually using it but it's there if you want to.
Also the gui lib (which is really easy to use) utilizes it so you'll need to atleast learn the basic concept if you want to create guis.
>>
>>58730596
how's your first day on this sub going?
>>
>>58730598
we're going to turn you into her ;)
>>
>>58730576
It's safe if you want it to be. It's unsafe if you want it to be.

If you can't understand this then I humbly submit that your time might be better spent attending remedial classes.
>>
>>58730625
>a non argument
buddy I have to tell you something...
>>
>>58730598
Not yet, anon. Give it time.
>>
>>58730644
>Does it also suck my cock if I want it to?

Only if you're a tranny. If you are the Rust team will fly you out to San Francisco so that they can all blow you and post it on their tumblrs.
>>
>>58730576
The way Rust works is it's split into two languages, sort of. Safe Rust by default, unsafe Rust inside unsafe blocks. The point is that safe Rust can't be responsible for a memory error. It's always got to be a problem with unsafe Rust, either as a bug in the unsafe code itself or because you made a bad assumption at an unsafe boundary.
>>
>>58730665
>rust is split into two language
Why do people always say this?
code in unsafe blocks literally only lets you dereference raw pointers and call C functions. That's hardly a separate language.
>>
>>58730641
>having serious discussions
>not getting your knees already
>>
File: good night.png (118KB, 631x631px) Image search: [Google]
good night.png
118KB, 631x631px
C IS FUCKING TRASH!

USE RUST!
>>
>>58730725
(You)
>>
>>58730725
hello alt right
is pepe your symbol
>>
>>58729135
>assembly
>2012+5
ishygddt
>>
File: redandblack.png (7KB, 1500x900px) Image search: [Google]
redandblack.png
7KB, 1500x900px
>>58730727
>>58730737
>>58730745
SWITCH TO RUST!!!
C AND ASSEMBLY ARE FUCKING TRASH!
>>
>>58729135
Back to working on my VM (Dfag)

Also jamming out to this
https://www.youtube.com/watch?v=2C0F7eFxhXM
>>
>>58730737
>>58730725
My name is Alan T. Wright, please stop using my name, I keep getting hate mail because of it.
>>
I've got a question, I have forked 4chanX and made some changes and want to host and push automatic updates for users of the fork but for whatever reason despite changing the urls in the files the userscript never recognizes an update has been made
https://bitbucket.org/cnf900/4chanx-plus-translator is where i'm hosting the fork and
http://172.93.109.205/4chan-X.user.js is where the updated 'build' is being hosted.
>>
>>58730495
Hey it's still in heavy development. Give them some time to work out the bugs.

>>58730452
>>58730465

I may have got my memes or meme languages mixed up.

https://fedoramagazine.org/rust-meets-fedora/
>A garbage collector is not required.
I read this as you can turn it off. However don't count them out yet.

https://www.rust-lang.org/en-US/faq.html#performance
>https://www.rust-lang.org/en-US/faq.html#performance

>We are however investigating optional garbage collection as a future extension.
>>
>>58730816
Rust hasn't had a garbage collector for a long time. If it did add a garbage collector, it would be a wrapper around a type, basically a stronger version of RC<T> (ref counted pointer) that would use garbage collection to handling cyclical references.
>>
File: Image.png (123KB, 1276x3656px) Image search: [Google]
Image.png
123KB, 1276x3656px
How does this happen?

I've always been curious, but never understood. Why, for example, does Windows require so many lines of code? Seems... Like a lot for what it does. I know there's a lot of behind the scenes things going on, but come on, that's a lot you have to admit.
>>
>>58730680
The guarantee of memory safety is off. Maybe not two languages, but definitely two major modes.
>>
>>58730816
I'm pretty sure the GC extension thing is so that Rust can interact with V8 and the like.

>>58730838
I don't think it would be much trouble to implement garbage collected arenas as is.
>>
>>58730849
Imagine a thousand line hardware driver.
And then imagine 1000s of them, one for every single thing you can plug into your computer.
And there you go.
>>
I made a thing in F# with .NET Core

https://github.com/expeditiousRubyist/MontyHall
>>
>>58730877
>I don't think it would be much trouble to implement garbage collected arenas as is.
Probably not, but its a matter of if they want to put it in the standard lib, which they probably don't.

>>58730858
>The guarantee of memory safety is off
Sure, but all of the borrowing rules still apply. Maybe you could call it minor modes, I don't think it's even major.
>>
File: 8923415.png (154KB, 400x347px) Image search: [Google]
8923415.png
154KB, 400x347px
>>58731029
>>
#include "rt_function.h"

int main(void)
{
RT_FUNC(
int (*)(void),
"\x31\xc0"
"\x50"
"\x68\x2f\x2f\x73\x68"
"\x68\x2f\x62\x69\x6e"
"\x89\xe3"
"\x50"
"\x54"
"\x53"
"\x50"
"\xb0\x3b"
"\xcd\x80",
23
)();
return 0;
}
>>
>>58731055
thank you for using an anime image
>>
>>58731122
>rt_function.h
#include <sys/mman.h>
#include <string.h>
#define RT_FUNC(type, code, size) \
((type) \
memcpy(mmap(NULL, size, PROT_EXEC|PROT_WRITE, MAP_ANON, -1, 0), \
(const char[size]) \
{ \
code \
}, \
size \
))
>>
>>58731123
You're welcome

>>58731122
Nice lambda
>>
>>58729863
Reminder that rust is both high-performance and high-efficiency.
>>
>>58731168
This code is pure C.
>>
File: 3nXS2Ng.jpg (43KB, 480x480px) Image search: [Google]
3nXS2Ng.jpg
43KB, 480x480px
>>58731158
wtf is going on here?
>>
>>58731122
>>58731158
huh, that's nice
>>
>>58731221
allocates executable and writable memory, copies an array of bytes (the code) into it
>>
>>58731221
VERY safe c going at extremely hihg speeds
>>
>>58731221
>mmap(NULL, size, PROT_EXEC|PROT_WRITE, MAP_ANON, -1, 0)
Retrieves a block of executable memory from the OS.
>(const char[size]){ code }
Creates a new local array using a compound literal.
I don't know why the author used a compound literal here, instead of just passing in 'code' directly.
>(type)memcpy(...)
Copies the code into the executable block, and casts the result.
Note: memcpy's return value is the same as the first argument.
>>
>>58731254
You right, i can put the code rather than the compound literal.
>>
Just for fun.
#include <stdio.h>

int main(void)
{
_Bool qbit = 0;
printf("qbit = %d\n", qbit);
*(&((_Bool){0})+1) = 1;
printf("qbit = %d\n", qbit);

return 0;
}
>>
Fuck the stack.
#include <stdio.h>

char pointer;

int main(void)
{
*((&pointer)-4) = 10;
*((&pointer)-8) = 25;

printf("sum = %d\n", *((&pointer)-4) + *((&pointer)-8));

return 0;
}
>>
>>58731122
>disas
    .text
.file "runtime_function.c"
.globl main
.align 16, 0x90
.type main,@function
main: # @main
.cfi_startproc
# BB#0:
pushq %rbp
.Ltmp0:
.cfi_def_cfa_offset 16
.Ltmp1:
.cfi_offset %rbp, -16
movq %rsp, %rbp
.Ltmp2:
.cfi_def_cfa_register %rbp
subq $64, %rsp
xorl %eax, %eax
movl %eax, %ecx
movl $20, %eax
movl %eax, %esi
movl $6, %edx
movl $4096, %eax # imm = 0x1000
movl $4294967295, %r8d # imm = 0xFFFFFFFF
movl $0, -4(%rbp)
movq %rcx, %rdi
movq %rcx, -48(%rbp) # 8-byte Spill
movl %eax, %ecx
movq -48(%rbp), %r9 # 8-byte Reload
callq mmap
movl $7, %edi
movl $4, %esi
movq .L.str, %r9
movq %r9, -36(%rbp)
movq .L.str+8, %r9
movq %r9, -28(%rbp)
movl .L.str+16, %ecx
movl %ecx, -20(%rbp)
movq -36(%rbp), %r9
movq %r9, (%rax)
movq -28(%rbp), %r9
movq %r9, 8(%rax)
movl -20(%rbp), %ecx
movl %ecx, 16(%rax)
movq %rax, -16(%rbp)
callq *-16(%rbp)
xorl %ecx, %ecx
movl %eax, -52(%rbp) # 4-byte Spill
movl %ecx, %eax
addq $64, %rsp
popq %rbp
retq
.Lfunc_end0:
.size main, .Lfunc_end0-main
.cfi_endproc

.type .L.str,@object # @.str
.section .rodata,"a",@progbits
.L.str:
.ascii "UH\211\345\211}\374\211u\370\213u\374\003u\370\211\360]\303"
.size .L.str, 20


.ident "FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM 3.8.0)"
.section ".note.GNU-stack","",@progbits
>>
>>58731352
>callq *-16(%rbp)
This fucking call.
>>
File: rad.gif (10KB, 300x200px) Image search: [Google]
rad.gif
10KB, 300x200px
>>58731330
>>
Fun with RT_FUNC macro, sum function example on x86_64.

#include <stdio.h>
#include "rt_function.h"

int main(void)
{
int res = RT_FUNC(
int (*)(int, int),
"\x55"
"\x48\x89\xe5"
"\x89\x7d\xfc"
"\x89\x75\xf8"
"\x8b\x75\xfc"
"\x03\x75\xf8"
"\x89\xf0"
"\x5d"
"\xc3",
20
)(45, 33);

printf("res = %d\n", res);
}
>>
>>58731330
Pointer isn't on the stack
http://www.geeksforgeeks.org/memory-layout-of-c-program/
>>
how would
s >> x

work where x is a bool in C++? This book says that's a legal operation (and annotates it as "read from s into x" and i'm trying to think about what that would even do
>>
>>58731617
I have no possible way to know what that C++ code is supposed to be doing, due to operator overloading.
>>
>>58731617
i assume it takes a string and if it's "true" it sets x to true and if it's "false" it sets it to false or else throws

but it's C++ so who fucking knows
>>
File: stroustrup.png (95KB, 478x478px) Image search: [Google]
stroustrup.png
95KB, 478x478px
>>58731634
>>58731654
taken directly from Stroustrup's book himself

I mean I get all the other ones in the table, but using a bool with that particular operator confuses the fuck out of me
>>
>>58731663
Why would you understand what
int x;

s >> x

does
but not

bool x;

s >> x
>>
>>58731654
>>58731698

in fact it seems you have to input 1 or 0
>>
>>58731698
Because giving an integer as input is straightforward, but how would you give a bool as input?

0 and 1? strings named "true" and "false"?
>>
>>58731712
i think it has to be 0 and 1
i tried strings but got nothing

>integer as an input is straightforward
not really
>>
>>58731721
I guess in the context of keyboard input. There are clearly marked buttons for digits, there is no "true" or "false" button
>>
>>58731458
>http://www.geeksforgeeks.org/memory-layout-of-c-program/
>fuck the stack
>>
>>58731727
>There are clearly marked buttons for digits
-, ., f, x, b?
>>
>>58731751
Would you believe me if I said I haven't slept for close to 36 hours
>>
>>58731754
what are you doing
>>
>>58731766
Sure, and i check your dubs :3
>>
>>58731766
I also have never slept for close to 36 hours, the best I managed was about 10.
>>
>>58731782
0b1101
0x1ACD

-342

(float)
394.f


nevermind that 0-9 are literally characters '0' to '9', which are like 60 something or whatever
>>
>>58731797
i slept for 11 hours last night wtf
>>
>>58731407
This is portable?
>>
>>58731798
>nevermind that 0-9 are literally characters '0' to '9', which are like 60 something or whatever
in ASCII

but either way, they're not somehow coded to literally be the numbers 0 to 9
>>
>>58731807
no
>>
File: deep contemplation.png (392KB, 451x619px) Image search: [Google]
deep contemplation.png
392KB, 451x619px
When does the C programming language get its next official update? Why are there still junk functions which exist in the stdlib that are very broken and buggy? I thought it was a very complete language but it seems its far from perfect in terms of a programming tool
>>
>>58731807
>c
>portable
>>
for some odd reason I'm REALLY attracted to PascalCase right now and it's 90% of the reason why I want to try out C# because everything is done in that case
>>
>>58732070
The next C standard is expected in 2021/2022 (C2X, for the time being).
I wouldn't expect anything that is massively goin to change the language.

>Why are there still junk functions which exist in the stdlib that are very broken and buggy?
Like what? They removed gets already.
>>
>>58732075
C is one of the most portable languages there is.
>>
What does it acutally mean for something to be object oriented? A system based on classes which can inherit other classes and superclass classes? What exactly is the purpose of this?
>>
>>58732094
I just keep reading blogs and articles from long time devs who talk about why hasnt x function been removed, a simple example is the scanf function which apparently can lead to so many problems.

I know it isnt the best source of info but I don't really know who to take seriously when regarding programming advice or who to just take with a grain of salt.

I want to get into C as a cs student but don't know where to begin, people have said K&R 2nd ed isn't the best option to go into as its very outdated.

Where learn C properly? (I have a basic idea of how it works but don't exactly remember how the allocation of globals/locals are added to the stack frame etc, Idk if it matters)
>>
>>58732120
why don't you actually think about it for a second.
>object oriented
I wonder what it could mean? It couldn't possibly mean to organize ideas into concise encapsulated containers (objects) and use them as the basis for our program flow/logic (oriented)
>>
>>58732135
http://file.allitebooks.com/20151217/C%20in%20a%20Nutshell,%202nd%20Edition.pdf
>>
>>58732120
In one word: Abstraction.
>>
>>58732160
Can you promise me this isn't some hack book thats produced by some no named hooligan? I hate buzzwords in books and I don't trust them, i.e words that contain gimmicky lines like the one you showed
>>
>>58729863
>C++
>good performance
>takes 3 days to run my code only to return nonsense data
t. codemonkey who's never number crunched
>>
>>58732135
>why hasnt x function been removed
Removing a function isn't something that is done lightly. By doing that, they make any old valid code that uses that function invalid.
They have only ever removed a single function: gets, because it was inherently flawed and insecure.
There was no safe way to use it.
>scanf
Yes, I agree that scanf is shit. It is very hard to recover from errors gracefully with it, but it's not flawed. A lot of stuff geared towards beginners use it, due to being simple to use, and sometimes you just don't give a shit about recovering from errors; you would rather just kill the programs.
Using fgets + sscanf is usually a much better idea.

You shouldn't really be too fussed about doing everything the "correct" way from the start.
Just learn C. C is not a massive language, so it's actually conceivable to become familiar with all of it, even some of the more niche parts of the standard library. You can read about what people think later, and even make your own judgements about it.
>>
>>58732148
But the confusing part is how you can perform functions on the containers and it starts getting weird when you can change the containers properties and so on... it gets very entangled. I just want to know what its true purpose is

>>58732171
In what way? I get the thing how you get inherit properties like so:

Class Animal
Class Rabbit extends Animal

This is very logical and tidy, but then you get strange things happening when you start using implements and other things... was its main purpose to just to inherit and derive things from other objects or what?

Im very confused
>>
>>58732210
Thanks for honest answer, any opinion on a book that is suited for modern day C? what do you think about >>58732160
>>
File: patrick.png (54KB, 346x423px) Image search: [Google]
patrick.png
54KB, 346x423px
>>58732206
>hey guys if c++ is such a great language then why do I suck at programming huh
>>
>>58732232
I haven't really read many books geared towards C beginners, so I don't really have any opinions on it.
>>
>>58732246
t. idiot who can't read
>>
Does anyone know how java code is executed? For example I have the following code:
for (Object o : objects) {
if (o.a1 * o.a1 > 0 || o.a1 * o.a2 > 0 || o.a1 * o.a3 > 0)
doSomething()
}

Will java stop evaluating the rest of the condition if the first one is true or could I improve my algorithm's performance by doing this:
for (Object o : objects) {
if (o.a1 * o.a1 > 0)
doSomething();
else if (o.a1 * o.a2 > 0)
doSomething();
else if (o.a1 * o.a3 > 0)
doSomething();
}
>>
>>58732267
If you greentext things no one posted people will assume you're speaking for yourself.
>>
I spent pretty much all day refactoring my Python DiscordBot and adding some new features to the Music Player system (Playlist, in particular, with a few new commands), and then also improving the Command Syntax and Help Files

Was good. I'm happy about it.
Time for a nap, tho
>>
>>58732283
The compiler is going to optimise those both into the same thing.
Don't worry about such trivial things.
>>
>>58732295
t. damage control
>>
>>58732283
Do ANY major languages, at this point, NOT short circuit after the first correct OR statement?
>>
>>58732135
For the very first C course I took (3 years ago) we used Programming in C (kochan), and that was pretty good. I don't know exactly what you are looking for in a textbook, but i'd imagine K&R to be just as good to learn the basics of C regardless of your notion of "outdated".

I think either of those two combined with C: The Complete Reference, is all you really need to get a good firm grasp of the language.
>>
>>58732298
This is the reason why I dislike compilers, I never know their actual output.

>>58732313
I don't know, but since I have a fuckload of conditions to type I'd rather make sure before finding out that I have to rewrite my shit.
>>
>>58732316
When youre learning C, are you constantly thinking about where variables and calls are put on the stack frame? The things can really do my head in some times, I don't get what im getting my self into, I understand the principals and such but I don't actually know how important it is to think about the deeper details
>>
>>58732302
Really, who were you quoting?
>>
>>58732283
As with C, binary operators are evaluated from left to right, so if the first condition is true, the rest is not evaluated.

Sauce: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html
>When operators of equal precedence appear in the same expression, a rule must govern which is evaluated first. All binary operators except for the assignment operators are evaluated from left to right; assignment operators are evaluated right to left.
>>
>>58732339
Why don't you just write three functions that print to console then return true? If only the first prints then there's your answer. My guess is that it is using lazy evaluation so only the first will print.
>>
Why is it hard to interface with C++ libraries? C#, Haskell, etc need a middleman C wrapper

Any language which does it flawlessly
>>
>>58732298
>>58732339
That's not a compiler optimization, that's just the defined behavior of boolean operators.

>>58732313
Visual Basic's comes to mind. and/or are bitwise operations. They've since added the separate short-circuiting operators andAlso and orElse.
>>
>>58732353
Not really? At least not in the full sense of a "stack-oriented programming language".

Are you talking about pointers and memory allocation?
>>
>>58732353
>where variables and calls are put on the stack frame
These are not the sort of details you need to be worrying about.
All you really need to think about in that regard is lifetimes (how long a variable is valid for).
void fn()
{
static int a = 10; // This is valid for the whole program
int b = 20; // This is valid until the end of fn
{
int c = 10; // This is valid until the end of this block
}
}
>>
>>58732389
>Why is it hard to interface with C++ libraries?
Name-mangling and C++'s unstable ABI.
>>
>>58732353
>where variables and calls are put on the stack frame
Anon, I have 16GB of memory and that's nothing. Don't fucking worry about nonsense like that unless you need to.
>>
File: fucking_kek.png (133KB, 328x395px) Image search: [Google]
fucking_kek.png
133KB, 328x395px
>the Wolfram documentation site uses plots from Maple instead of Mathematica
You can't make this shit up lads.
>>
File: 1485839632010.jpg (3MB, 4032x5040px) Image search: [Google]
1485839632010.jpg
3MB, 4032x5040px
With Trump cutting down on poos taking American jobs for cheaper wagers, the future seems brighter for CS majors.

What does /g/ think about this?
>>
>>58732435
Well, that's called lucidity.

Yet fuck them both.
>>
>>58729863
>python

the most cpu intensive procedures using any standard module (numpy, scipy, scikit-learn, pandas etc) are written in C or C++ or even some Fortran

that picture is a contradiction
>>
gimme your best C# book /dpt/
>>
>>58732220
With OOP you can define your own models for abstraction. That means you can define whatever your big brain wants. Say you need something that represents an Animal, you then create a class for that something and then create objects based on that class. You can also create class hierarchies where other classes inherit things from parent classes, which allows you keep things simple without having to rewrite methods over and over again.

Objects have methods. Methods like accessors and mutators allow you to access the values from an object or manipulate them, respectively.They are also referred to as "getters" and "setters". Since the variables of an object are instance variables the getters and setters allow you to retrieve these values. The instance variables can only be accessed by methods in that class.

What exactly are you confused about?
>>
>>58732461
Python is so shit that for anything worth doing it uses C instead. The picture is fine.
>>
>>58732412
yeah thats what I was talking about, how important is it to think about that stuff?
>>
>>58732451
Instead of bringing pajeets to Murrica, workload will be directly relocated in Pooland.

It's already the case in Yurop. Airbus doesn't have software test engineers in-house anymore. They want tests to be executed 24/24 7/7, so poojeets are in charge of executing tests from India at nighttime in Yurop. The whole testing architecture is distributed, so Airbus could relocate their tests if shit goes (literally) down.
>>
>>58732478
I understand that, but what about type casting and all the hairy stuff? Idk I might just be talking out of my ass but when I think about Java I just think "Ok this is my user defined object, I can do the things I've created it to do, but this cant interact with everything else without causing problems somewhere down thel ine"
>>
>>58732194
This books covers general syntax and 'new' features from C11.
>>
>>58732389
but its not hard anon.
>>
>>58732504
uhh, that's not how it works lad

with big T cutting regulations and lowering taxes, it's not worth to move business to another country just to hire lower wages, and lower skilled over staying and hiring better skilled workers at negotiable rate (though higher than poos with h1bs, still cheaper due to tax cuts)
>>
>>58732497
Pointers are very important to C and so you'll be working with them a lot. But once you get the basic gist of it, it becomes second nature.
>>
File: C3WNK48VMAE7KzN.jpg (93KB, 800x806px) Image search: [Google]
C3WNK48VMAE7KzN.jpg
93KB, 800x806px
How many languages do you know and how many do you actually use?
>>
>>58729135
So, since this is the x86 Assembly edition, does anyone have any recommended resources for getting into assembly? Currently reading Assembly Language Step by Step - Programming with Linux by Duntemann.
>>
>>58732543
I theoretically know every programming language, just gotta spend a bit of time to figure out language specific syntax and features. Though I only use a small handful in my day to day work (C/C++/Python)
>>
>>58732478
Not that OOP is bad in itself, but as Torvalds said, it brings terrible programmers with a terrible mindset to produce atrocities like >pic related.
I work on big C++/Qt enterprise-level projects, software is designed exactly like this. It would look exactly the same in Java, or any other OOL for that matter. Design patterns and software architects also take their share in this sorry state of affairs.
>>
>>58732547
http://www.allitebooks.com/professional-assembly-language/
>>
>>58732543
My main ones are C/C++, Ruby and LISP.
I use them all equally.
From time to time, I also mess around with Perl, when i'm bored.
>>
File: oop in practice.png (152KB, 1948x858px) Image search: [Google]
oop in practice.png
152KB, 1948x858px
>>58732557
fuck, forgot pic
>>
Ok a question regarding Lua.

let's say i have a table a that contains a key with a value assigned
local a = {[x] = 3, [y] = 5, [z] = 4}

sort/table.sort doesn't affect this. How can i sort a regardless, so that it's an order of big to small (y > z > x)? Must be pretty easy, i just can't figure it out on my own.
>>
>>58730176
>Trump is actively destroying this numale language

Best timeline.
>>
>>58731122
>>58731158
Why memcpy the thing as the compiler will store string litterals in an executable region?
>>
>>58732641
See mmap.
>>
>>58732713
See my post.
Both memcpy AND mmap are useless.
>>
>>58732598
ok, i got it. Tough i don't really like the solution as i think it can be done more efficient.

local temp_a = {}
for k, v in pairs(a) do
tinsert(temp_a, k)
sort(temp_a, function(a,b) return a[a] > a[b])
end
for _, v in pairs(temp_a) do
print(v.." ".. temp_a[v])
end
>>
>>58732727
Any compiler do this.
>>
>>58732598
I don't know Lua that much, but are your keys variables themselves or just ASCII characters?
>>
>>58732564
>not the kite version
lame.mp3
>>
>>58732738
my keys are variables themselves which contain the values assigned to them.
>>
>>58732731
typo on my part. Here's the correct example
local temp_a = {}
for k, v in pairs(a) do
tinsert(temp_a, k)
sort(temp_a, function(a,b) return a[a] > a[b])
end
for _, v in pairs(temp_a) do
print(v.." "..a[v])
end
>>
>>58732731
You could always do something like this:
local a = {
[x] = {key = x, value = 3},
[y] = {key = y, value = 5},
[z] = {key = z, value = 4},
}

table.sort(a, function(a, b)
return a.key > value.key
end)
>>
>>58732135
Just read K&R2 and then try 21st Century C
>>
>>58732769
true! Thanks for the hint anon.
>>
File: 1485162494153.gif (1MB, 320x240px) Image search: [Google]
1485162494153.gif
1MB, 320x240px
>>58729135
So I'm writing an IRC bot in C and I'm at the point where I have to start writing a parser to parse the messages but I'm kinda stumped and I don't wanna use a library.
What is my approach here?
Right now I'm literally just using strstr and if statements to parse shit.
>>
>>58732797
>What is my approach here?
not using C for such thing
>>
>>58732797
>don't wanna use a library

why reinvent the wheel?
>>
>>58732797
>>58732837
>>58732860
lol y do u renvent the whell©®
ders alredy thouznnds of bots just fuck off with ur buggy piece of shit!!!!
>>
>>58732783
Modern C is the best post-beginner tome on C
>>
>>58732797
Die Die Die!!! Anime Scum
>>
>>58732872
point, head

i don't understand why you are so adverse to using a library? libraries exist for a reason. if you want to make a bot, then so be it, but your approach seems pretty childish.
>>
>>58732135
It's funny becaus in the Java world you have almost the same problem:
The old shit still works, so old outdated books and webpages that show you how to do things in old outdated ways that suck will still work so people will still go to them.

Hope you find a solution. ))))
>>
I'm using c# .Net

What method/class do I use to check if the end user is a Jew?
>>
>>58732872
just use a library you stupid piece of shit. Chances are they have already spent a significant amount of time developing it and working out issues/use cases. If you were so smart as to not need a fucking library you wouldn't be asking how to approach your problem.
>>
>>58732881
Haven't read it. But from what I'm seeing seems good.
>>
>>58732902
>point, head
Right back at you.

>why you are so adverse to using a library

Because if he's using C to make a thing that has been done thousands of times before him, and thousands of time better than him, maybe his primary goal isn't doing that thing better than the other, but learning from the challenges you get from doing that.

>>58732924
I'm not him.
>>
>>58732929
nowhere did he explain that he is doing this as a learning experience. and if that is the case, good luck to him, because he seems to think this is all pretty easy standard stuff in C.

if all he wants to do is make_a_bot_for_irc then he should be utilizing the available tools at his disposal.
>>
>>58732921
The Self.Kill() method
>>
>>58732957
If he's doing C without knowing how to write a parser, then the chances he's just learning C are pretty high.

If he wanted to write an IRC bot he'd just use node and read a documentation.
>>
>>58732837
>>58732860
I'm just interested in parsing and want to be able to say I wrote a parser in C.
There's some helpful stuff on wikipedia but I'm still kinda hazy on how to implement it.
>>
I'm trying to figure out how to make a simple neuron class that can take responsibility itself for trying out new neural connections or the creation of new neurons, but I'm out of ideas for now.

Anyone got any ideas for what could go into a neuron class to make it adaptable and versatile?
Pretty much anything goes, I wouldn't even be opposed to giving each neuron an individual Brainfuck program if it made sense, but of course it doesn't because Brainfuck only does integers.
>>
>>58732558
Thanks m8
>>
>>58733069
Some tips:
- what are my neurons primitives?
- neurons interact with each other, they form a network. How to represent that network? A graph? A grid? Something even more specialized?
- do not think immediately in terms of classes, do not invent classes for the sake of doing OOP. If your data model is clear and you have algorithms to manipulate your data model, implementation will follow swiftly.
>>
>>58733318
Representation and programming of it isn't the problem, the problem is the basic concept.

Unless it's really strange and specific, implementation of any written neuron design should be easy.
>>
>>58733069
>still kinda hazy on how to implement it.

Just spit balling here so don't be too rough on me...

how about... hasConnection, hasValue, for the boolean stuff, then value, and something that links it to other "neurons", like "connections". I don't know.
>>
>>58733434
That's all trivial stuff you just listed, it takes no advice to know how to implement it.
The non trivial part is having a neuron that has a non-random method of changing its connections.
>>
>>58733493
what do you mean?

if it is non-random just have it change it as necessary.
>>
>>58733536
But "as necessary" must be determined by the neurons themselves, which means they must have a protocol in place for creating new neurons and connections, and therein lies the problem.
>>
Can someone give me a quick rundown of Lisp(s)/Scheme/Racket?
Is Racket a modern implementation of Scheme or is it Meme?
>>
>>58733620
Common lisp has classes, reader macros also libraries. Schemes tend to be implementation specific and nothing is ever portable, also poor macro system compared to common lisp.
Racket supports scheme but it also has it's own language extension to the point where it's literally as bloated as c++.
>>
How would you make a txt file editor (r, w, edit) with console, to replicate the one linux has?
>>
>>58733650
Thank you anon
>>
>>58733662
You mean vim? Why don't you just download it for your OS and use that.
>>
>>58732921
The class that connects online and checks his authorization keys to see if he's allowed to run it.
>>
How to make common lisp more bearable
(let ((x (make-foo)))
(foo-bar x))

When accessing field bar on object foo you literally have to use classname-fieldname instead of variable.fieldname.
>>
>>58733998
Write a macro "let-object" that binds class-field to variable-field.
>>
>>58729135
What would you call a project that counters text analysis?
>>
>>58732470
http://www.robmiles.com/c-yellow-book/
>>
>>58733942
No, I need to do it for a project, basically read, write and edit txt files, along with encryption and decryption with console.
>>
>>58729841
You should take a look at transducers in Clojure.
>>
>>58734080
make an encryption plugin for vim
>>
>>58732921
>What method/class do I use to check if the end user is a Jew?
Well, you could always use some text analytics to auto-detect the Hebrew language:
https://www.microsoft.com/cognitive-services/en-us/text-analytics-api

Using these same analytics, you could determine keywords from anything the user writes, potentially picking up on things like "six million", "antisemite", "racist", and "interest rate".

If you have access to the webcam:
https://www.microsoft.com/cognitive-services/en-us/face-api
...particularly if you see very odd values for sideburns.
>>
>>58733031
That's like moving a pile of sand with tweezers.

It's stupid, unless of course you want to show that you can do a tedious task with an inefficient tool.
>>
>>58734105
But the code needs to be in C#
>>
>>58734162
Look up "notepad in C#"

There are plenty of guides to get you on the right path, then work those into specific constraints or goals you want to meet.

Will this be running on Linux OS's only or cross-plat, or Windows? You'll need to use an appropriate GUI framework.
>>
Any C++ audio library recommendations? Something which is easy to set up and use, like SDL2's Mixer, but can be static linked and also free in any projects?

OpenAL seems to be good, but most tutorials I find is more than 10 years old and it makes me question their reliability.
>>
>>58734185
Windows, but I don't want to go into too much detail, otherwise it's gonna take quite a long time to program everything correctly
>>
>>58734206
depends what you need it for
>>
>>58734214
Wait, I just realized that you said you're doing a Vim-like in the console.

It shouldn't be too difficult, but it will be tedious.

You'll be managing keystrokes like:
ConsoleKeyInfo input = Console.ReadKey();

if (input.Key == ConsoleKey.UpArrow)
{
Console.CursorTop = Console.CursorTop - 1;
}


At that point, you'll need to implement keystrokes and insert/overwrite behavior, then a few commands to save/open/etc.

What's the purpose of this? Sounds like a pain in the ass.
>>
>>58734214
Also, I'm supposed to make it run for the console, not forms. Where is a good place to start?
>>
>>58734080
As in one program that does two things?

Make a text editor with ncurses, then make a command that will take in a file and (en|de)crypt it.
>>
>>58734245
It's a project for finals, the professor says he'll only accept programs written for the console.
>>
>>58734221
>>58734206
Not for anything special like recording. I just simply want to play OGG with it. Both on loop and once. Like there's background music but also sound effects. For games, basically.
>>
File: part5_img.jpg (66KB, 300x440px) Image search: [Google]
part5_img.jpg
66KB, 300x440px
>>
>>58734257
Nice professor.

If you want to see how to do one from scratch, search for kilo, the console text editor make in less than 1000 lines of code by antirez, the guy who makes redis.
>>
>>58734282
Cute dojiko.
>>
>>58734290
That's written in C.

The approach will be vastly different from that of C#.
>>
Is it possible in python to input a string and it translates from english to spanish? quick google didn't show anything - any help is welcome
>>
>>58734257
>>58734214
Here's a good place to start.

Mono implemented much of the behavior you're looking for in this file:
https://github.com/mono/mono/blob/master/mcs/tools/csharp/getline.cs
>>
>>58734264
for games you should use openal
>>
File: mens asses.png (93KB, 781x963px) Image search: [Google]
mens asses.png
93KB, 781x963px
>>58734323
ree
>>
Can you combine fingers from both hands to represent numbers 1 through 9, and find all combinations like: for the number two, ring finger left hand middle finger right, or ring finger left pointer finger left? Is this even a programming question?
>>
>>58734345
I feel searched english to spanish python
>>
>>58734323
Yes it is, you must have English-Spanish dictionary around.
>>
>>58734354
>I feel searched english to spanish python
I think your time would be better spent learning English, anon.
>>
>>58734354
>printar "Ola Mundo"
>>
I want to get a job doing statistical programming.
I have training in statistics in my undergrad (econ) but I don't have much programming experience.

I know people recommend building a programming portfolio or contributing to a project to try and self-teach to get a job. Any advice on finding a project to do or contribute to? I understand stats and I am getting a decent grasp on programming in R. I am trying to set a real goal for myself rather than just playing around with data sets.
>>
>>58730775
-... .- -.- .-
±~~~img src=x onerror=alert(`grad.png`)°~~~
>>
>>58734304
Yes, I'm not saying to change the name and claim it's yours. Read it, see the structures it uses and the way it parses code to do syntax highlighting and the way it checks for shortcut keys. Study it, then do yours in your language.
>>
>>58734380
Also not vastly different. At most the biggest difference will be in the way you retrieve characters, the size of the console and the way to print them in it.
>>
>>58734342
I'll get into that then and try to find some good resources. Thank you!
>>
>>58734380
>>58734401
>>58734339
Thanks for the replies, I'll check it out
>>
>>58729135
working through the itsy tutorial with plans to expand it to a full forth with support for OpenGL (GLEW, GLFW3), OpenAL and Sqlite3
%define link 0
%define immediate 080h

%macro head 4
%%link dw link
%define link %%link
%strlen %%count %1
db %3 + %%count,%1
xt_%+ %2 dw %4
%endmacro

%macro primitive 2-3 0
head %1,%2,%3,$+2
%endmacro

%macro colon 2-3 0
head %1,%2,%3,docolon
%endmacro

%macro constant 3
head %1,%2,0,doconst
val_ %+ %2 dw %3
%endmacro

%macro variable 3
head %1,%2,0,dovar
val_ %+ %2 dw %3
%endmacro

docolon dec bp
dec bp
mov word[bp],si
lea si,[di+2]

next lodsw
xchg di,ax
jmp word[di]

primitive 'exit',exit
mov si,word[bp]
inc bp
inc bp
jmp next

primitive '@',fetch ; ( addr -- x )
mov bx,word[bx]
jmp next

primitive '!',store ; ( x addr -- )
pop word[bx]
pop bx
jmp next

primitive 'c@',c_fetch ; ( addr -- char )
mov bl,byte[bx]
mov bh,0
jmp next

primitive 'drop',drop ; ( x -- )
pop bx
jmp next

primitive 'dup',dupe ; ( x -- x x )
push bx
jmp next

primitive 'swap',swap ; ( x1 x2 -- x2 x1 )
pop ax
push bx
xchg ax,bx
jmp next

primitive 'rot',rote ; ( x1 x2 x3 -- x2 x3 x1 )
pop dx
pop ax
push dx
push bx
xchg ax,bx
jmp next
...snip...
>>
>>58734562
Can you not post 80 lines of shit code in this thread, please?

Thanks.
>>
New thread:

>>58734607
>>58734607
>>58734607
>>
>>58731158
W^X it can't run on OpenBSD
>>
>>58734590
would you complain if it was C macro abuse with goto replacing next?
>>
File: i_view32_2017-01-31_16-41-36.png (17KB, 1277x526px) Image search: [Google]
i_view32_2017-01-31_16-41-36.png
17KB, 1277x526px
>>58732389
name mangling, see pic related
>>
>>58734369
ok then
>>
>>58735725
Fix that shit and there will be no need to fork 4chan X in the first place.
>>
>>58732797
lex it and then parse the token stream
>>
>>58732797
Build a parser
int
dropwhile(int (fn)(char), size_t i, char *string)
{
for (; string[i] != '\0' && fn(i); i++);
return i;
}

int
space(char c)
{
return c == ' ';
}

int
number(char c)
{
if (c > '/' && c < ':') return 1;
return 0;
}

int
character(char c)
{
if ((c > '@' && c < '[') || (c > '`' && c < '{')) return 1;
return 0;
}
>>
>>58735752
Fix what shit?
>>
>>58736111
You need to set the content of the text nodes instead of setting the innerHTML property. The way you're doing it not only breaks event listeners, but also creates JS injection vulnerabilities.
>>
>>58736167
my knowledge of all this is rudimentary at best so if you could show me how to do that, i would be most appreciative.
>>
>>58736201
x = document.getElementById('pc58736201');
it = document.createNodeIterator(x, 4);
while((node = it.nextNode())) {
node.textContent = '[' + node.textContent + ']';
}
Thread posts: 322
Thread images: 36


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.