[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: 323
Thread images: 29

File: cpp.jpg (12KB, 260x321px) Image search: [Google]
cpp.jpg
12KB, 260x321px
Previous thread: >>61711760

What are you working on, /g/?
>>
>>61716012
printf("rust is for faggots\n");
>>
>>61716012
Second for D
>>
>>61716039
printf is for faggots
>>
>>61716059
Little reason to use cout when it has 2000x the overhead if you don't need to use any of its features.
>>
>>61716101
sepples stream syntax sucks, but at least it doesn't need redundant type specifications
>>
Java is pure.
>>
>>61716150
>cripples you with no real multiple inheritance
>still has the diamond problem
bravo
>>
C is pure.
>>
>>61716101
>Little reason to use cout
Little reason to use printf when you can use puts.
>>
Reading K&R.
>>
>>61716210
That f in printf is actually useful though
>>
Why is it that nobody in these threads is ever actually working on anything, but instead is just arguing over what programming language is best?
>>
>>61716288
Because 4chan is all about yelling at people for having different opinions.
Why do you think?
>>
>>61716288
because I'm embarrassed
>>
>>61716255
Not if all you want to print is line
>rust is for faggots
>>
>>61716288
Why don't you post what you're dong?
>>
>>61716321
Ce drăcie grăit-ai despre mine, mojicule? Țiu să-ți aduc întru știință căci fusei întîiul din Școala de Rezboiu de la Viana și fusei în multe misii neștiute la Înalta Poartă și pre mulți am prăpădit. Sînt școlit în rezboi de vicleșug și niminea nu mînuiește mai acătări ca mine archebusul în toată armia cea sfîntă. Mi-ești dară numai o șaibă. Te voi mătrăși cu atîta pricepere ce n-a văzut întreg Stambulul, ascultă voroavele mele. Îți închipui că vei rămîne slobod dupe ereziile ce mi le grăiești pre ceastă jalbă? Rogu-te a chibzui iară. Numai ce vorbim de am trimes soli către iscoadele mele din țările rumâne iară copita murgului tău e taman vegheată așa că proptește-te întru viforul ce-are să vină, mamelucule. Viforul ce-are să spîrcuiască nimicnicia ce tu găsești de cuviință a numi vieață. Ești pristăvit, mojicule. Poci ca să fiu orișiunde, fieștecînd și poci a te stropși în șapte sute de chipuri, iară asta doar în brînci. Iată că nu doar ce sînt înalt școlit în trîntă, dară poci umbla la armurăria dorobanților și am să mă slujesc de dînsa întru totul pentru a-ți nimici șezutul de pe fața gliei, zamparagiule. O, numai de-ai fi vezuit ce amărăciune vei fi ispitit asupra-ți cu ceastă şăgalnică cuvîntare, pasămite ai fi muțit. Dară nu-ți fu în putință, n-ai cadaticsit, iară acum vei da tribut, nărodule. Iată voi slobozi urgie asupra-ți și de îndată te vei năbuși într-însa. Ești pristăvit, mojicuțule.
>>
File: 1499903386716.png (299KB, 565x644px) Image search: [Google]
1499903386716.png
299KB, 565x644px
>>61716356

naruhodo
>>
>>61716320
Then just use puts, I'm just saying printf is still useful unlike IO streams
>>
>>61716386
Fair enough.
>>
>>61716012

SICP chapter 2 binary mobile question.
>>
>>61716321
Currently waiting on other people to finish/fix backend shit so I can finish my work. Other than that jack shit. Maybe test out some mobile database options, or go through some interview prep questions to stay on top of stuff

Usually I come to these threads to get ideas, but all anyone talks about is language wars
>>
File: poop.png (24KB, 1339x622px) Image search: [Google]
poop.png
24KB, 1339x622px
>>61716386
>61716386
>>
>>61716485
I'm afraid I don't understand
>>
>it took me a week to realise i was calling a class instead of an object
am i retarded?
>>
File: 1496551925995.jpg (19KB, 400x400px) Image search: [Google]
1496551925995.jpg
19KB, 400x400px
>>61716039
>Using printf instead of fputs or even puts to print a constant string to stdout
ISHYGDDT
>>
>>61716517
arguably
>>
File: 1482023924871.png (119KB, 1349x629px) Image search: [Google]
1482023924871.png
119KB, 1349x629px
>>61716012
I geniunely can't tell, is the book in OP's pic about C or is it about C++?
Looking through its Amazon page[1], there are some reviews like pic related that confuse me.

[1] https://www.amazon.com/dp/0672326965
>>
i'm trying to understand what this command does
grep -oP '"url_id": "\K([^"]*?)"'


according to grep manual:
-o = Print only the matched (non-empty) parts of a matching line,
with each such part on a separate output line
-P = Interpret PATTERN as a Perl regular expression
>>
File: s.png (62KB, 1680x1050px) Image search: [Google]
s.png
62KB, 1680x1050px
>>61716288
>>61716012
>What are you working on, /g/?

Exploring the deepest, darkest corners of racket.
>>
>>61716625
c primer plus is about C
c++ primer is about c++
>>
>>61716625
Prata has written C Primer Plus and C++ Primer Plus.

https://www.amazon.com/Primer-Plus-6th-Developers-Library/dp/0321928423

https://www.amazon.com/Primer-Plus-6th-Developers-Library/dp/0321776402/

2 different books.
>>
>>61716625
>c++ is a horrible language
>>
>>61716012
Are the Prata books any good for learning C? I'm asking as a beginner to programming, I need to learn C for uni (EE degree before anyone starts recommending other meme languages)
>>
>>61716626
It searches for strings matching the given regular expression.
For more information about Perl REs, see http://perldoc.perl.org/perlre.html
>>
>>61716696
K&R is pretty good to learn C.
>>
>>61716738
no it isn't
>>
>>61716738
I doubt this was the question.
>>
>>61716696

C Programming a modern approach is what I always recommend. K&R may be a little difficult if you have no experience in another language. Programming in C is another option, can easily find that one online as a pdf.
>>
Writing an x12 parser in PowerShell because fuck everything
>>
>>61716696
I've heard bad things about his C++ book. Don't know about the C one
>>
>>61716753
At least for me, it was.
>>
>>61716696
I prefer k n king's book.
>>
>>61716720
hmm ok got it.

i'm downloading a whole web page html and then there's a bunch of JSON data
and in it there is the line
{
...,
"url_id": "https://example.com.-1.dnf.lopeio.net/t12.555.jpg"
}



so basically searches the whole HTML for the url_id attribute and finds the expression associated with it
>>
>>61716765
>C Programming a modern approach is what I always recommend
Thanks anon, I'll hit up libgen. Are there any common pitfalls that I need to be aware of when beginners are learning C?
>>
>>61716738
it's shit
>>
>>61716790

That's what is great about the book, it has common pitfalls annotated throughout it.
>>
>>61716789
Exactly.
>>
>>61716696
It's probably the actual best C book
>>
>>61716386
I disagree. You can pass an IO stream to a function that takes a generic stream. You can't really do that with printf. This lets you write some more declarative code in many cases.
>>
>>61716797
no u
>>
>>61716806
>102mb for the PDF copy of the book

This better not be a fucking scanned copy.
>>
>all these stories about interviewees failing to write fizzbuzz
is the standard really that low? will simply knowing how to write fizzbuzz immediately land me a $300k starting job?
>>
>>61716855

They don't make retail PDF of the book, so it's almost certainly scanned lul.
>>
>>61716820
>>61716881
I think I'll start with the Prata book since there's a real pdf copy and downloading from libgen is slow af for me at the moment.
>>
>>61716855
If it's the K. N. King's C Programming: A Modern Approach then yes, it is a scanned copy.
I actually have it myself.
>>
>>61716907
That's a decent book as well. You may struggle if it's babies first language though.
>>
>>61716955
I did a short module on matlab if that counts for anything.
>>
>>61716101
std::cout has no extra overhead.
And it's type safe.
>>
File: 1480662637735.png (1MB, 2234x3159px) Image search: [Google]
1480662637735.png
1MB, 2234x3159px
>>61716923
Here's how it looks like.
It's annoying but it's a good book.
>>
>>61717028
>c++ is a horrible language
>>
Let's settle this once and for all.
Is artificial intelligence a meme?
Is machine learning a meme?
>>
std::cout actually has lower overhead than printf.
It doesn't have to parse the format string, and it can be better optimized by the compiler than printf.
>>
>>61717039
I've seen crappier scans. Wonder why the author doesn't have a decent electronic copy of his book.
>>
>>61717055
Sort of. Unlikely we ever get real AI in the sci fi sense
And no ML is not a meme. Its very useful in a lot of areas.
>>
>>61717059
>>61717028
Not exactly a compile-time Rust macro though is it?
>>
>>61717087
To stop people pirating it most likely.
>>
>>61717059
LIES!
I just made a very simple test, and printf was faster than cout:
/* printf */
#include <iostream>
#include <cstdio>

int main(void)
{
int i;

for (i = 0; i < (1 << 10); ++i)
printf("%s\n", "Test!");

return 0;
}


/* cout */
#include <iostream>
#include <cstdio>

int main(void)
{
int i;

for (i = 0; i < (1 << 10); ++i)
std::cout << "Test!" << '\n';

return 0;
}


Compiler::
g++ -O0 -o cout cout.cc
g++ -O0 -o printf printf.cc


When I did
time ./cout
and
time ./printf
, the former finished in 6ms, and the latter in 5ms.
>>
>>61717154
I'd seriously consider buying it if it wasn't $100
>>
>>61717190
>-O0
>>
>>61716012
got an adroid question, is it possible to take and access an photo aka a bitmap without having to save it to a file first? Right now it seems I can only access the thumbnail unless I want to fuck with the content resolver
>>
which

let color = isBlue ? "blue" : "green";


or

let color;
if (isBlue) {
color = "blue";
} else {
color = "green";
}
>>
>>61717230
We don't want the compiler to optimize the difference between them away.
>>
>>61717237
the first, obviously.
>>
>>61717199

All college textbooks have ridiculously inflated prices.
>>
>>61717237

The ternary.
>>
>>61717237
Remind me why ifelse doesn't behave like a ternary again
>>
>>61717239
>and it can be better optimized by the compiler than printf.
way to miss the point
>>
File: indresting.png (88KB, 303x232px) Image search: [Google]
indresting.png
88KB, 303x232px
Currently between semesters studying Computer Science
Wanted to learn something more instead of just working/playing vidya all summer.
Decided I'd go through all the courses that Codecademy has.
I thought something like this would kill any desire to keep learning to be a programmer, but it did the opposite.
I'm more than half-way through and realized I could also just read some books instead, so I went through the /g/ wiki.
Now I'm just considering which book I should start on.
SICP seems like a good place to start.
>>
File: 1405708740980.jpg (126KB, 2048x1536px) Image search: [Google]
1405708740980.jpg
126KB, 2048x1536px
>>61717287
>SICP seems like a good place to start.
Ah, the meme book.
>>
>>61717278
I did the same with -O3, and the results are the same: printf still beats cout.
Sometimes they run in the same amount of time, and sometimes printf is faster.
>>
>>61717311
I wish I had real physical books instead of PDFs.
>>
>>61717145
Of course, Rust macros btfo both C and C++ when it comes to formatted printing.
It has both the comfort and simplicity of format strings and the type safety of C++ streams (due to the format string being precompiled).

Future versions of C++ might be able to do the above, though. We just need to improve constexpr and templates a little bit, and maybe wait for reflection to land, and we should be able to precompile format strings into stream statements.

>>61717190
You suck at benchmarking.
These are my results using the exact same code, O2 optimizations, compiled with g++:
$ time ./printf > /dev/null && time ./cout > /dev/null
./printf > /dev/null 0.00s user 0.00s system 63% cpu 0.003 total
./cout > /dev/null 0.00s user 0.00s system 68% cpu 0.002 total // point
$ time ./printf > /dev/null && time ./cout > /dev/null
./printf > /dev/null 0.00s user 0.00s system 80% cpu 0.004 total
./cout > /dev/null 0.00s user 0.00s system 65% cpu 0.003 total // point
$ time ./printf > /dev/null && time ./cout > /dev/null
./printf > /dev/null 0.00s user 0.00s system 59% cpu 0.006 total
./cout > /dev/null 0.00s user 0.00s system 79% cpu 0.004 total // point
$ time ./printf > /dev/null && time ./cout > /dev/null
./printf > /dev/null 0.00s user 0.00s system 69% cpu 0.002 total // point
./cout > /dev/null 0.00s user 0.00s system 80% cpu 0.004 total
$ time ./printf > /dev/null && time ./cout > /dev/null
./printf > /dev/null 0.00s user 0.00s system 60% cpu 0.003 total
./cout > /dev/null 0.00s user 0.00s system 74% cpu 0.002 total // point
$ time ./printf > /dev/null && time ./cout > /dev/null
./printf > /dev/null 0.00s user 0.00s system 62% cpu 0.003 total
./cout > /dev/null 0.00s user 0.00s system 58% cpu 0.003 total
$ time ./printf > /dev/null && time ./cout > /dev/null
./printf > /dev/null 0.00s user 0.00s system 72% cpu 0.002 total
./cout > /dev/null 0.00s user 0.00s system 72% cpu 0.002 total


cout: 4
printf: 1

But really, it's about the same.
>>
>>61717340
> >/dev/null
What's the point of printing if you're redirecting output to /dev/null
>>
>>61717332
Apartments are storage constrained systems. Storing large amounts of objects in them is prone to cause book shelf overflow
>>
>>61717352
Because we're not benchmarking how fast the terminal can render characters you fucking retard, we want to get rid of that bottleneck.
We want to benchmark purely how fast printf and std::cout can format and write it's arguments out to stdout.
And they're about the same.
>>
>>61716012
C Primer Plus?
What The Fuck is this shit OP?
>>
>>61717332
the physical copy of the sicp is shit
the pages are thing, bendy crap and the cover's plastic peels
>>
>>61717311
What's the origin of the SICP snake meme?
>>
>>61717435
ancap autism
>>
>>61716528
both clang and gcc convert it to puts anyway. Also >using fputs for intended stdout
>>
I am playing around learning rust, and I am trying to write a this function that compares two strings and returns how many characters they have in common with each other. I keep getting an error about borrowing chars1 and chars2 as immutable and then as mutable afterwards. Here is what I got:

fn commonCharacterCount(s1: String, s2: String) -> i32 {
let mut outputChars1: Vec<char> = s1.chars().collect();
let mut outputChars2: Vec<char> = s2.chars().collect();
let mut commonCharacterCounter: i32 = 0;

return countACommonCharacter(&mut outputChars1, &mut outputChars2, commonCharacterCounter);
}

fn countACommonCharacter(chars1: &mut Vec<char>, chars2: &mut Vec<char>, charsFound: i32) -> i32
{
for (i1, x) in chars1.iter().enumerate() {
for (i2, y) in chars2.iter().enumerate() {
if x == y {
chars1.remove(i1);
chars2.remove(i2);
countACommonCharacter(chars1, chars2, charsFound+1);
}
}
}
return charsFound;
}


And here is the compilation error:

error[E0502]: cannot borrow `*chars1` as mutable because it is also borrowed as immutable
--> file.rs on line 14:17
|
16 | for (i1, x) in chars1.iter().enumerate() {
| ------ immutable borrow occurs here
...
19 | chars1.remove(i1);
| ^^^^^^ mutable borrow occurs here
...
24 | }
| - immutable borrow ends here



What am I doing wrong?
>>
>>61717287
SICP is pretty good for some intro concepts for comp sci.

The fact that it's taught in Scheme, a functional language, means that you'll learn stuff like high order functions and why they're useful. And if you have any hesitation in using recursion, this will get rid of it.

It will teach you some basic data structure stuff like stacks, queues, trees, etc. Plus some real applications of that stuff, like Huffman coding trees.

https://mitpress.mit.edu/sicp/full-text/book/book.html
>>
>>61717467
retard
>>
File: s.png (135KB, 1680x1050px) Image search: [Google]
s.png
135KB, 1680x1050px
day 18 done!
>>
>>61717469
>>61717426
Yeah, SICP is an exception, I prefer this copy of it:
https://github.com/sarabander/sicp-pdf
>>
>>61717486
So that's what Emacs looks like... Not so bad.
>>
>>61717426
A better print than the cheap one actually does exist
(top left in this picture)
http://www.principia-m.com/ts/0050/index-jp.html
>>
where can i find a table of assembly instruction sets? like MOV a, b or ADD a,b
>>
>>61717534
it's a casual config actually. a full config look like this https://github.com/hlissner/emacs-doom-themes/tree/screenshots
>>
>>61717664
And how about the nyan cat at the bottom?
>>
>>61717633
https://lmgtfy.com/?q=x86+table
>>
>typedef struct
>>
>>61717694
don't do it anon
just use a class
>>
>>61717687
it's nyan-mode
>>
>>61717690
>didn't select Internet Explainer option
Not obnoxious enough
>>
>>61717694
What's wrong with that?
What if I don't want to keep using
struct mystruct
everytime I want to declare a variable or cast a void pointer or something?
>>
File: WHITE NATIONALIST.jpg (99KB, 1214x1140px) Image search: [Google]
WHITE NATIONALIST.jpg
99KB, 1214x1140px
>>61717690

t-thangs anen
>>
>>61717534
No, it's heavily modded.

Actual emacs is poop cancer.
>>
>>61717752
>No, it's heavily modded.
not at all. nyan-mode + a color theme + the bar menu/icons disabled
>>
>>61717729
You're right, I'll do that.

>>61717690
https://lmgtfy.com/?s=d&iie=1&q=x86+table
>>
>>61717752
https://emacs.sexy/
>>
>>61717798
http://spacemacs.org/
>>
Why aren't you live coding on Twitch, anon?

https://medium.freecodecamp.org/lessons-from-my-first-year-of-live-coding-on-twitch-41a32e2f41c1
>>
>>61717736
struct is informative. I know what a
struct Foo
is, I don't know what a Foo is. Go use sepples if you want data hiding.
>>
Sometimes 'experts' can be quite dumb, I just had to deal with this guy overcomplicating a problem. He had written a pretty complex algorithm to orient a hierarchy or mechanical joints along a 3D axis, since the last joint didn't have a children in the hierarchy he had programmed an algorithm that calculated the extension of an imaginary line between the last two joints, created a temporary locator on that line, oriented the tip joint toward that temp locator and then deleted the locator.

Meanwhile, I just zeroed out the orientation on the tip with a single line of code and the API we're using simply inherited the orientation from the hierarchy, in one line of code. It's not even a single occurrence, all the fucking time they come up with retarded solutions that make them look smart but are extremely inefficient.
>>
>>61717826

>latest video
>1.5 hours and only half a dozen lines of code

what
>>
>>61717839
To quote 21st Century C's author:

A Style Note
I was surprised to see that there are people in the world who think that typedefs are
obfuscatory. For example, from the Linux-kernel style file: “When you see a vps_t a;
in the source, what does it mean? In contrast, if it says struct virtual_container
*a; you can actually tell what a is.” The natural response to this is that having a longer name—and even one ending in container—clarifies the code, not the word struct
hanging at the beginning.
>>
>This page is in Romanian. Would you like to translate it?
Dlang E V E R Y W H E R E
>>
>>61717789
>>61717862
But that isn't what I am trying to do even.

commonCharacterCount("abc", "aab") would return 2 because they each have 1 a and 1 b in common.
>>
>>61717736
I only use typedefs in implementation files, that way you can keep opaque pointer to structs in the header file of the form

struct foo; // incomplete type
void foo_whatever(struct foo* handle, ... );
>>
>>61717894
>Using Google's non-free web browser.
>>
File: python.jpg (715KB, 1600x900px) Image search: [Google]
python.jpg
715KB, 1600x900px
Why aren't you using the language of Miss Kobayashi?
>>
>>61717918
one an Apple non-free operating system I might add!

wanna learn me some swift, boss suddenly wants fucking apps
>>
>>61717254
>tfw it costs €35 brand new w/ 1 day delivery in my country
but then:
>tfw kurose & ross networking top-down approach book costs $165 in the US but €39 here
>tfw i want it the english version and that's €400
>>
>>61717935
Because I don't know who she is or what her language is, and also I already am using languages that I like.
>>
>>61717466
Figured it out a different way.

fn commonCharacterCount(s1: String, s2: String) -> i32 {
let mut commonCharacterCounter: i32 = 0;
let mut s2 = s2;

for s1char in s1.chars() {
for i in 0..s2.len() {
if s1char == s2.chars().nth(i).unwrap() {
commonCharacterCounter += 1;
s2.remove(i);
break;
}
}
}

return commonCharacterCounter;
}

>s2.chars().nth(i).unwrap()
>strings don't implement being able to access them at an index
>i have to do this to access a character at a given index
I thought rust was supposed to be the hip new meme? What the fuck is this shit?
>>
>>61717466
>>61718669
That's a really stupid and inefficient way for what is a really easy problem.
>>
>>61717935
>having to try aliased imports
what a shitlang
>>
>>61718669
It's just that a meme.

Eww O(n^2). I'll give you a hint: Your algorithm should be O(n) for sorted strings. Write one for sorted strings, then sort the strings.
>>
Someone post the trap memes a friend doesn't believe me
>>
File: 1498172119455.jpg (41KB, 640x480px) Image search: [Google]
1498172119455.jpg
41KB, 640x480px
>>61718793
for real what the fuck
>>
File: 1501639484597.png (471KB, 795x561px) Image search: [Google]
1501639484597.png
471KB, 795x561px
>there are people on this board wasting their time programming in anything besides C/C++, Java, or Python

w-e-w-ing at all of your lives desu fampais
>>
>>61717466
In Haskell, this is just

length . Data.List.intersect
>>
>>61717236
It's difficult to search for mobile stuff. So go to the Android api site and search from there:
https://developer.android.com/reference/android/hardware/camera2/package-summary.html
Short answer:yes, but you should read this to understand what you want exactly.
>>
>>61718819
>C++, Java, or Python
>over Lisp, Perl, Forth, and Asm
Kill yourself.
>>
>>61718819
>C/C++
Why are you grouping two completely different languages together?
>>
File: 1501354566011.jpg (5KB, 200x200px) Image search: [Google]
1501354566011.jpg
5KB, 200x200px
>>61718877
>MOM come here! I made a funny!
>>
>>61718669
int common_chars(const char *s1, const char *s2)
{
int r = 0;
while (*s1 && *s1) {
if (*s1 == *s2)
++r;
++s1;
++s2;
}
return r;
}
>>
>>61718893
>while (*s1 && *s1)
keepin it klossy
>>
>>61718877
>>61718819
Yeah, he's right, stop this “C/C++” meme. >>61715660
>>
>>61711285
Why are sepples programmers mentally handicapped?
C doesn't have constexpr and the reasons this is UB should be plainly obvious.
>>
>>61718890
I had no idea C can do templates now.
>>
>>61718908
What does that even mean?
>>
>>61718921
Logical fallacy, you surrender. C++ inherited from C, not other way round.

Atheists win again, dumb ass.
>>
61718941
They are two different languages though?
Im done supplying this shitty troll with (you)s
>>
You already surrendered, I inferred your previous post to just be you trying to save face.
>>
>>61718893
>>61718933
I see my mistake now. I meant
(*s1 && *s2)
obviously.
>>
File: 1501786324908.jpg (261KB, 869x1776px) Image search: [Google]
1501786324908.jpg
261KB, 869x1776px
>>61718990
reminded me of
>(a > b && b < a)
>>
>>61719026
I wonder why she didn't use
if (a < b && b > a)
in the first one.
>>
>>61716012
All I want is a RAD Python IDE that runs on linux and respects my freedoms. I'm not asking too much.
>>
>>61719026
max(0, 0)
returns 5. Thank you, “girls” who “code.”
>>
>>61718893
#include <stdio.h>
int common_chars(const char *s1, const char *s2)
{
int r = 0;
while (*s1 && *s1) {
if (*s1 == *s2)
++r;
++s1;
++s2;
}
return r;
}

void main() {
char * a = "brainlet";
char * b = "abrainlet";
printf("%s\n", a);
printf("%s\n", b);
printf("%i\n", common_chars(a, b));
}

$ ./iforgottotestmycode
brainlet
abrainlet
0

Correct solution:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int cmp(void const * a, void const * b) {
return *(char signed const*)a - *(char signed const*)b;
}

int common_chars(const char *s1, const char *s2)
{
char * a = malloc(sizeof(char) * (strlen(s1) + 1));
char * b = malloc(sizeof(char) * (strlen(s2) + 1));
memcpy(a, s1, sizeof(char) * (strlen(s1) + 1));
memcpy(b, s2, sizeof(char) * (strlen(s2) + 1));
qsort(a, strlen(a), sizeof(char), cmp);
qsort(b, strlen(b), sizeof(char), cmp);

int r = 0;
while (*a && *a) {
if (*a == *b) {
++r;
++a;
++b;
} else {
if(cmp(a, b) < 0)
a++;
else
b++;
}
}
return r;
}

void main() {
char * a = "brainlet";
char * b = "abrainlet";
printf("%s\n", a);
printf("%s\n", b);
printf("%i\n", common_chars(a, b));
}

$ ./workingcode
brainlet
abrainlet
8


Always test your code before you post it anon.
>>
>>61719095
It's fake. Karlie Kloss is just new and paid to make programming seem like something cool people do.
She wouldn't post things like this.
>>
>>61719126
I didn't understand the problem correctly.
>>
>>61719126
>sizeof(char)
You're the brainlet.

6.5.3.4 The sizeof operator
Constraints
3. When applied to an operand that has type char, unsigned char, or signed char,
(or a qualified version thereof) the result is 1. When applied to an operand that has array
type, the result is the total number of bytes in the array.85)When applied to an operand
that has structure or union type, the result is the total number of bytes in such an object,
including internal and trailing padding.
>>
>>61718793
>>61718807
this is great actually

try:
import module_written_in_c as module
except ImportError:
import module_written_in_python as module

module.foo(...)
>>
File: 308723532.jpg (223KB, 1580x824px) Image search: [Google]
308723532.jpg
223KB, 1580x824px
>tfw paying $5000 a semester to draw pictures with turtles in python
>>
>>61719179
>error handling for your imports
Next youre gonna make a class for them.
>>
>>61719177
It's called a coding convention, retard. Not that hard to copy and paste sizeof(char).
>>
>>61719211
>not char.sizeof
>>
>>61719205
modules are also objects in python.
>>
>>61719226
Like i said
S H I T
L A N G
>>
>>61719126
Your solution is garbage.
#include <stdio.h>
#include <stdbool.h>
#include <limits.h>

int common_chars(const char *s1, const char *s2)
{
bool chars1[UCHAR_MAX] = {0};
bool chars2[UCHAR_MAX] = {0};

for (; *s1; ++s1)
chars1[(unsigned char)*s1] = true;

for (; *s2; ++s2)
chars2[(unsigned char)*s2] = true;

int count = 0;

for (int i = 0; i < UCHAR_MAX; ++i)
if (chars1[i] && chars2[i])
++count;

return count;
}

int main()
{
const char *s1 = "brainlet";
const char *s2 = "abrainlet";
printf("%s\n", s1);
printf("%s\n", s2);
printf("%d\n", common_chars(s1, s2));
}
>>
>>61719205
Python being dynamic, you can import a module anytime during the execution, you can even do

exec("import " + input())
>>
>>61719179
I use python to a very limited extent. And it's convenient. I had a levenshtein distance library that had a python and a C implementation. It warns you that the program is running the python version and tells you where to get the C version. But for a quick prototype messing with that is pointless. It's a great idea.
>>
>>61719256
>you can import a module anytime during the execution,
I can import stuff in functions anywhere as well, without the need to POO up my code.
>>
>>61719245
Your solution is wrong though anon.
$ ./hethinkshessmart 
brainletbrainlet
brainletbrainlet
8

AND it is slower than mine.
>>
>>61719273
it's also great for hot patching, you can send a module (native or not) through network then load it on the fly.
>>
>>61719323
That sounds like an extremely niche usecase/bad practice. Don't write serious software in python.
>>
>>61719316
I'm not even 100% sure what the original problem was.
>>
>>61716012

What's the deal with Gnu Savannah?

It's like github but for Gnu stuff?
>>
>>61719336
>That sounds like an extremely niche usecase/bad practice.

that's what jp morgan does on their biggest software. you probably know nothing about real use softwares.
>>
>>61719126
>while (*a && *a)[/code]
See >>61718908

Sorry, but someone did this to me, now I'm getting my revenge.
>>
File: 1487227407571.png (90KB, 463x522px) Image search: [Google]
1487227407571.png
90KB, 463x522px
>>61719126
>void main()
>>
File: tendies.png (179KB, 1025x531px) Image search: [Google]
tendies.png
179KB, 1025x531px
Are there any good resources on blockchains similar to those being used for cryptocurrencies? I kind of want to try building one from scratch as an exercise. I don't really want to make a coin or anything, especially since it'll probably be amateurish as fuck and open to exploits, but I thought it'd be interesting to do something like a blockchain bulletin board.
>>
>>61719506
C++let detected.

>>61719478
I'm blaming you for this since I just copied your code and inherited that bug. I'll have my revenge anon.
>>
>>61719468
>you probably know nothing about real use softwares.
If you think jp morgan is the epitome of good design then I don't think there's any doubt you know less than nothing about real world software development.
Hotloading code is a process which needs more supervision than the import statement can provide conveniently.
>>
>>61719550
>C++let detected.
What the fuck does that have to do with C++?
void main is definitely invalid C.
>>
>>61719550
>C++let detected.
Are you accusing me of using sepples?
No, this void main thing is not valid C code either, anon. Look at the Standard.
main has to be declared as either
int main(void)

or
int main(int argc, char *argv[])

or equivalent.
>>
>>61719562
Wrong. It's implementation dependent in c99. And valid in gcc.
>>
>>61719608
And why would you rely on such pointless and retarded implementation defined behaviour?
>>
>>61719592
>tfw you can call main with 3 args

int main(int argc, char **argv, char **envp)
>>
>>61719616
Because I don't care about clanglets. It's also valid on Microsoft's compiler.
>>
>>61719626
That's not standard C.
>>
>trying to learn assembly
>doing stuff takes so much manual effort that it's tiring
>can't get motivated to do the next lesson
>afraid to use high level languages because i don't want to be a pleb that writes awful code because he doesn't know how computers work

i think i might've had one too many vaccinations
>>
>>61719626
>
char **envp

I'm always looking for good >>61719626
excuses to do this to fuck over windows users but there aren't any usually.
>>
>>61719637
So what?

Programs are written for computers not nebulous language specs.
>>
>>61719630
You're fucking stupid.
You literally have to change a SINGLE token to make your program standards conforming. And yet you choose not to.
You don't even need to write
return 0;
, because that shit is implicit.
>>
>>61719646
Write C code and only debug it in asm for a while.
>>
>>61719646
Assembly doesnt even teach you how computers work.
If you truly want to know, then thats CPU dev, both hard and software.
The only reason to learn assembly is if you want to work on compilers or reverse engineering like emulators.
>>
>>61719658
Uh... Portability?
I still don't mix declarations and code, and don't make use of VLAs, and don't use long long, because I want my programs to conform to C89 aka ISO/IEC 9899:1990.
>>
>>61719658
>Programs are written for computers not nebulous language specs.
This is one of the stupidest posts I have read today.
>>
>>61719691
>>61719696
The 3rd argument is valid in Microsoft C and gcc:

https://msdn.microsoft.com/en-us//library/k104fy6h.aspx

http://crasseux.com/books/ctutorial/Environment-variables.html
>>
>>61719660
Again anon, I don't care. If it won't compile on your system, submit a memo to the author of your second rate compiler and change it to int.

There's no reason to not have void main() be valid.
>>
>>61719691
>I want my programs to conform to C89
That's fucking pointless. Do you also make sure to worry about the results of modulo on negative numbers?

>>61719716
There are situations where compiler extensions and relying on implementation defined behaviour is justified, but this one is just so pointless and stupid.
If you're not following the C standard, you're not writing "C".
>>
>>61719691
>I still don't mix declarations and code, and don't make use of VLAs, and don't use long long, because I want my programs to conform to C89 aka ISO/IEC 9899:1990.
Well not of all us are targeting Amiga. My targets are 64 bit linux and maybe windows.
>>
>>61719760
My targets are my own linux distro, but still.
>>
>>61719770
Then update your compiler.
>>
>>61719691
>I still don't mix declarations and code, and don't make use of VLAs
Worthless restriction.
>>
>>61719779
$  gcc --version
gcc (GCC) 7.1.1 20170528
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

It's already up to date, but I'm a little bit autistic, and have -std=c89 -pedantic in my CFLAGS.
>>
>>61719760

Even the Amiga supports at least C99.
>>
>>61719801
>-std=c89 -pedantic
but why
>>
I'm gonna write a website using C++ web toolkit

How's that, huh??
>>
>>61719821
>I'm a little bit autistic
>>
>>61719837
Thats awful.
use C or asm and save yourself some headache.
>>
>>61719837
use kore.io on C
>>
>>61719849
>>61719837
https://learnbchs.org/
>>
>>61719868
Looks good.
>>
>>61719868
>C is a straightforward, non-mustachioed language.
kek

Anyone actually tried? It looks ok tbqh
>>
>>61719868
>want to try
>no openbsd hosting
>>
>>61719978
Install it yourself in a VM.
>>
Can this code find any prime within its range, or am I missing some thing?


 for num in range(1, 100):
if num % 2 == 0 or num % 3 == 0 or num % 5 == 0 or num % 7 == 0:
print(num)
else:
print(str(num) + " Is a Prime Number")
>>
What is the cheapest way to play around with Apple devtools? Used mac mini?
>>
>>61720078
Nope that works perfectly for its range. You only need to test for numbers up to sqrt(max).
>>
>>61720078
Look up the sieve of Eratosthenes.
>>
>>61720098
Is there a limit as to when it won't work?
>>
>>61720078
Here's my (not very OPTIMISED) C prime function:
bool is_prime(unsigned long long int p)
{
unsigned long long int i;

if (p < 4)
return true;
if (!(p & 1))
return false;

for (i = 3; i * i <= p; i += 2)
if (p % i == 0)
return false;

return true;
}
>>
>>61720078

No you are missing 2 3 5 7 and you need to get rid of 1.
>>
>>61720151
This.
>>
>>61720151
Thanks, I didn't even think about that.
>>
>>61720138
Yes, 121 is a not a prime number, but will get flagged as such with your function.
>>
>>61720146
>
 if (p < 4)
return true;
if (!(p & 1))
return false;

Swap these two,
>>
>>61720138
No. If a number n has a number larger than sqrt(n) as a factor, then it has a number smaller than sqrt(n) as a factor.
>>
>>61720186
Your indentation is misleading.
>>
>>61720193
I copied it but only selected from the start of the chars on the first line so it omitted the spaces for that line.
Also, no, it's not MY indentation and it's not misleading.
>>
>>61720146
Primality tests get inefficient anyway.

It's much better to do pseudoprimality tests for large numbers. There's algorithms like Fermat's Test that are good for generating numbers which are 99.999999% likely to be primes. That's how RSA keys are generated.
>>
>go to irc channel
>everyone ignores you
i bet they're waiting for me to disconnect ;_;
>>
>>61720273
just go away already, geez
>>
>>61720273
i bet you ask stupid questions
>>
>>61720273
Connect with another nick from something like KiwiIRC, and disconnect from the other, and then start shit-talking your(other)self, and see their reactions.
>>
>>61720286
pls say hi to me i'm lonely
>>
>>61720297
>KiwiIRC
Fucking muslim meme spammers.
>>
File: c.jpg (139KB, 1080x1080px) Image search: [Google]
c.jpg
139KB, 1080x1080px
>>61720305
hello
>>
>>61720316
What?
>>
>>61720273
At any one time at least 95% of people in a channel are just idling
>>
File: 1501811068755.jpg (442KB, 857x1202px) Image search: [Google]
1501811068755.jpg
442KB, 857x1202px
What's the best programming snack food?
>>
>>61720465
Water and steamed chicken.
>>
>>61720465
Water. Snack foods exist just to make you fat desu. You can't eat snack foods, work a sedentary job like programming, and eat square meals all at once. You have to choose two.
>>
File: no direction in life.png (344KB, 1277x718px) Image search: [Google]
no direction in life.png
344KB, 1277x718px
>>61720465
whatever my mom makes is the best food
>>
>>61720485
fucking THIS

why move out when i can live at home and eat mom's cooking?
>>
>>61720476
Where are your vitamins and fiber, bro?
>>
>>61720476
steamed water and medium rare chicken
>>
man just trying to use rust I perpetually find little C niceties missing

hopefully it'll make up for it if I try to use functional programming techniques and do things the rust way

all I can say, learn C/C++ before you bother with rust, and I do mean bother. It's got a ways to go imo

also am I about to get buttfucked by modules? I can't seem to figure them out intuitively
>>
File: 1463007116894.gif (1MB, 320x213px) Image search: [Google]
1463007116894.gif
1MB, 320x213px
>>61720506
>medium rare chicken
>>
>>61720509
Nice reddit spacing you have there, mate.
I can't even be bothered reading your fucking post.
>>
>>61720509
>going into Rust thinking anything from C will be there
stop being a baka
>>
>>61720536
every day without fail

im going to start doing this just for you
>>
>>61720536
r

e

d

p

i

l

l

m

e

o

n

"

r

e

d

d

i

t

s

p

a

c

i

n

g

"
>>
>>61720544
yeah I didn't think they would be but I do like the option of things like positional struct fields, file-level encapsulation (call me old fashioned and you'd be right), and some other things

guess I'm just finding my way around
>>
>>61720273
Is this your first time in an irc? This shouldn't be new. Try getting answers from the SDL irc, that's even worse.
>>
Man, I'm starting to like Rust. I really like slices, I think they quite nice.
>>
>>61720740
I think I might try to create a tripcode generator in Rust as a small project.
>>
>>61720740
do you know about slices in Go? I love them. https://github.com/golang/go/wiki/SliceTricks

imo slices in rust need a little bit more freedom, but I can see why they make a lot of that stuff unsafe
>>
How to get gud with databases? I always feel like a complete retard when people talk db, is there some clrs of databases?
>>
>>61720740
>>61720751
I just speed tested my Rust merge sort against my C merge sort and found that C is like 40 times faster. ;/ Zero cost abstractions my ass. When you abstract something, there is almost always going to be a slow down trying to generalize something.

>>61720773
I think I might learn Go after Rust. I think it is a really nice language; I already have The Go Programming Language book. I was quite disappointed with it actually, I read the first chapter and was kind upset that the book wasn't similar to the original C Programming language and all. However, I think Go is pretty powerful since it has a lot of nice standard libraries.
>>
>>61720778
if you like theory then you could check out relational calculus
>>
>>61720800
And that speed test was with Rust optimized and C unoptimized.
>>
>>61720818
>>61720800
Wait nevermind, I fucked up.
>>
>>61720800
The thing I've found about Go is, it's modest, complete, and readable. You have to write a decent amount of it to realize why it's good, but it's good.

>>61720818
was gonna say dude, it should not have a big speed difference
>>
>>61720800
Go is a very easy language to learn, I went through Go By Example (typing out every example by hand, to make sure I actually have to think about it all) in about a day. Between that and godoc as a reference, I was able to start rewriting useful new code almost immediately.

It's weird. Objectively, I hate a lot of things about Go, but the range of problems where those things either don't come up, or come up too infrequently to matter, is large enough that I rarely mind.
>>
What's the best way to learn java as a beginner programmer? thenewboston's tutorials?
>>
>>61718669
>fn commonCharacterCount(s1: String, s2: String) -> i32 {
> let mut commonCharacterCounter: i32 = 0;
> let mut s2 = s2;
>
> for s1char in s1.chars() {
> for i in 0..s2.len() {
> if s1char == s2.chars().nth(i).unwrap() {
> commonCharacterCounter += 1;
> s2.remove(i);
> break;
> }
> }
> }
>
> return commonCharacterCounter;
>}

This is a sub-optimal solution, learn how to use iterators. You can use the .next() method to increase two iterators in parallel

If I am not mistaken, this function should do it:

fn common_character_count(s1: String, s2: String)
-> u32
{
let mut common_char_count = 0;
let mut iter_s1 = s1.chars();
let mut iter_s2 = s2.chars();

while let Some(ch1) = iter_s1.next() {
if let Some(ch2) = iter_s2.next() {

let mut c1 = ch1;
let mut c2 = ch2;

while c1 != c2 {
c2 = iter_s2.next().unwrap_or(break);
}

common_char_count += 1;

} else { break; /* no more chars in s2 */ }
}

return common_char_count;
}

It has linear runtime.

https://gist.github.com/336a016391e702a7449b4792c7539fb0

Notice how the original code gives a wrong answer - only 9 characters overlap, but the original functions shows 12.

The C versions ignores Unicode characters. That's the reason Rusts string handling is more complicated for newcomers.
>>
>>61720913

A good book
>>
>>61720913
Do you really want to learn java?
>>
>>61720924
>>61720913

*A good book to learn the content, then pick up Clean Code by Robert Martin to polish your style.
>>
What verb would you use to name a function [verb]x() that checks the value of x and corrects it if it's wrong?
>>
>>61720922
>>61720922
fn common_character_count(s1: String, s2: String)
-> u32
{
let mut common_char_count = 0;
let mut iter_s1 = s1.chars();
let mut iter_s2 = s2.chars();

while let Some(ch1) = iter_s1.next() {
if let Some(ch2) = iter_s2.next() {

let mut c1 = ch1;
let mut c2 = ch2;

while c1 != c2 {
c2 = iter_s2.next().unwrap_or(break);
}

common_char_count += 1;

} else { break; /* no more chars in s2 */ }
}

return common_char_count;
}


Copied the wrong link and fucked formatting, sorry.

https://play.rust-lang.org/?gist=336a016391e702a7449b4792c7539fb0&version=stable
>>
>>61720959
baka_patrol
>>
>>61720959
Probably "check", "correct", or "fix"

or make up something stupid, like maybeDisembadulate
>>
>>61720863
Actually, with a bigger dataset I found that C was faster than Rust.
>>
>>61720959
in what way does it fix it? Name it that. Otherwise "fix".

>>61721021
Not surprised really. Also post your code nigga
>>
>>61721021
no shit faggot.
stop responding to rust faggots.
>>
If I care about data transfer speed between a windows service and a GUI which IPC method should I use?
So far I have looked at:
WCF
Named Pipes
Shared Memory
>>
How does /dpt/ feel about Oberon?
>>
>>61720959
revise
>>
>>61720925
Why not?
>>
>>61721104
seems like shit.
>>
>>61720959
checkValueOfXAndCorrectItIfItIsLong()
>>
Need help naming a class.

My program runs a 'process' loop X amount of times per second, which is used to update the state of the program.

I have made a class that can be derived from, and used to run a method (called 'process') only every Y loops.

Eg:
Program runs 50 (X=50) loops a second
My sprite only needs to update 5 times a second, so I use my class to make it count to 10 (Y=10).

What should that class be names? The best I've come up with is ProcessLoopSubscribed

thanks /g/uys
>>
>>61721188
>My sprite only needs to update 5 times a second, so I use my class to make it count to 10 (Y=10).
Is this a joke?

Anyway the best name for your class is "unsigned int"
>>
File: 1501736517262.jpg (54KB, 573x431px) Image search: [Google]
1501736517262.jpg
54KB, 573x431px
What is the best book to learn C as a former webdev who is familiar with high level languages (js, python, java)
>>
new into programming, the API I'm using is pretty old and if you want to get a particular color you need an int but that's not very user friendly
What's better, an enum for each color and then a switch statement, or a dictionary with strings as keys? I think the dictionary is more straightforward but for some reason I don't like comparing strings, I feel like someone's going to write a typo and then won't be able to figure out what's wrong with it, or maybe they won't be sure if they need to capitalize the word, or what.
>>
>>61721211

You could probably get away with K&R. If that's abit too much, C a modern approach.
>>
>>61721205
>Anyway the best name for your class is "unsigned int"
It's a class that is derived from. Like I said
>>
>>61721211
Here: https://doc.rust-lang.org/stable/book/second-edition/
You'll thank me later.
>>
I'm trying to learn babby android development and do bluetooth connectivity; when I set up the default BluetoothAdapter object:
// sets up default Bluetooth adapter object;
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();


it seems fine but then as soon as I call (((certain))) functions, Android Studio highlights them in red and says "cannot resolve symbol" and seems to not find mBluetoothAdapter as a legit class.
if (mBluetoothAdapter.isEnabled()) {
String status;
String deviceAddress = mBluetoothAdapter.getAddress();
String deviceName = mBluetoothAdapter.getName();
status = deviceName + " : " + deviceAddress;
Toast.makeText(this, status, Toast.LENGTH_LONG);
}


What's weird is in the above, isEnabled() is red and can't be resolved, but getAddress() and getName() work fine, within the if statement. Does it have to do with that?
>>
Is The Clean Coder by Robert Martin worth it?
>>
>>61721248
C a modern approach by k.n king?
>>
>>61721412
Yes.
>>
>>61721254
I know. You're abusing oop though. Just make sprites conditionally render based on the modulus of the frame number to some internal data field.
>>
>>61721420
This isn't just for sprites. It's for everything that doesn't need to be ran 50 times every seconds.
I have AI threads that start every X loops using it.
I have reports that only need to be ran every X loops.
It works, and it's easy to use.
Just wanted a class name that sounds better than ProcessLoopSubscribed or ProcessEveryXLoops
>>
File: fbo_upsidedown.png (36KB, 356x329px) Image search: [Google]
fbo_upsidedown.png
36KB, 356x329px
>>61716012
Working on my minecraft clone.

Rendering to field buffer objects to generate icons for blocks. Fucking opengl renders to field buffer objects mirrored in both the x and y axis. Those committee fuckers.

I gotta remove some kludges once I get the fucking upside down textures thing fixed. Right now:
>have to manually allocate layer in the menu texture array for the fbo
>this limits the number of block icons to 64
>no mechanism to lazily update fbo: either have to render it every frame or render it at startup
>menu texture array is same size as block texture array
>>
>>61721530
What language you writing it in?
>>
>>61721632
Chef.
>>
>>61716012
I'm learning how to make games using Lua.
I'm hoping to make a basic dungeon crawler.
>>
>>61721332
I've realized that if I start to type the name of mBluetoothAdapter anywhere in a method or like above, within that if statement, android Studio autocompletes it and knows exactly what I'm talking about, and also lists all the relevant method calls.

But it's only when I reference the object in the main method, or like above, within the *condition* for the if statement, it completely fails to recognize it. What the hell? Am I just stupid here
>>
>>61721632
C and Scheme
>>
>>61721687
>make games using Lua.
vomitinganimegirl.jpg
>>
>>61721824
Looks good, you got the source in a public repo?
>>
>>61721832
I asked /agdg/ for advice on making a dungeon crawler and they did not respond so I just picked a 2D tool from their link (Love).
>>
>>61721824
Use rust you dumbo.
>>
>>61721993
>Rust
AHAHAHAHHAHAHAHAHAHAHHAHAHAHHAHAHAHHHAHAHHA
>>
File: happy.jpg (41KB, 394x353px) Image search: [Google]
happy.jpg
41KB, 394x353px
>>61721919
Good luck with that anon.
>>
>>61722006
If you have a better suggestion, I'm open to ideas.
>>
>>61722035
No, I was just being nice and genuinely meant good luck.
>>
>>61722039
Oh okay, thanks.
>>
>>61721919
I used Love2D for a mobile game for university.
It's nice as long as you don't want to make anything huge.
Also, Lua is fun
>>
I'm not that experienced with programming
I just started android studio
I can't run the app I get this error.

Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Unexpected lock protocol found in lock file. Expected 3, found 0.

I'm using windows 8.1
I set my environement variable java_home to my java sdk folder.

I don't know what's wrong
>>
>>61722135
Yeah, I hate how people trash on Lua by saying stuff like
>LOO-uh
>he uses a language where array indices start at 1
># doesn't always work correctly
But I like Lua because it is small but powerful and fast.
>>
>>61722184
Break down your error and learn on your own what it means.
>>
>>61720922
jesus christ [ code ] exists you know
>>
File: 1461387408179.png (81KB, 231x250px) Image search: [Google]
1461387408179.png
81KB, 231x250px
>>61722245
Jesus Christ codes?
>>
>>61722257
only in holyC
>>
>>61722257
This without the space will make the code readable:
[ code ]
// insert code here
[ /code ]

like this:
// insert code here


fucking use it
>>
File: higher-resolution-icons.png (244KB, 816x618px) Image search: [Google]
higher-resolution-icons.png
244KB, 816x618px
>>61721853
Not yet. Soon(TM). Actually I feel like I'd committing an injustice against myself by releasing it for free desu. Not really possible to pull a Linus on a free game.

>>61721993
>Rust
AHAHAHA. That would be an absolute disaster!

Rust doesn't even have documented bindings to OpenGL 4.5, let alone a FFI to Scheme.

>>61722194
You forgot about the part where Lua uses doubles to index arrays. People fail to understand that double representations of integers less than 2^53 are exact.

I used to use Lua as a scripting language. The reason why I'm using Scheme and not Lua though anymore is the C FFI in Lua makes me wanna kill myself. God it's so verbose.
>>
>>61722348
Would love to see it if you do. How much more you planning to do with it?
>>
>>61722348
>Lua uses doubles to index arrays
Lua doesn't have "arrays", it has tables.
In Lua, you can index a table with basically anything, except nil.
Also, the latest version of Lua is supposed to have proper integers, but I'm not actually sure how it works.
>>
New thread:
>>61722378
>>61722378
>>61722378
>>
>>61721919
>I asked /agdg/
There's your problem. Don't ever trust those idiots.
>>
>>61719245
int common_chars(const char *s1, const char *s2)
{
int a[256] = {0};
int b[256] = {0};
int r = 0, i;
while (*s1)
++a[*s1++];
while (*s2)
++b[*s2++];
for (i = 0; i < 256; ++i)
r += a[i] < b[i] ? a[i] : b[i];
return r;
}
>>
>>61716496
don't be afraid of what you don't understand
Thread posts: 323
Thread images: 29


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