[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: 327
Thread images: 38

File: cbd.gif (3MB, 1005x742px) Image search: [Google]
cbd.gif
3MB, 1005x742px
What are you working on, /g/?

Old thread: >>62288936
>>
Daily reminder Lain is the only allowed anime girl itt.
>>
Can someone explain why the output here is from the base class rather than the derived class?

class Test{
int a = 200;
}

class Test1 extends Test{
int a = 100;
}

public class Main {

public static void main(String[] args){

Test t = new Test1();

System.out.println(t.a);


}

}
>>
File: 1487022728214.png (626KB, 840x904px) Image search: [Google]
1487022728214.png
626KB, 840x904px
Make sure to start your day off right with Lainos.
>>
File: lain_text.gif (6KB, 299x115px) Image search: [Google]
lain_text.gif
6KB, 299x115px
>>62296116
>tfw LainOS will never be finished
http://lainos.sourceforge.net/index.php
>>
>>62296075
>>62296098
Methods are dynamic dispatch but member variables are not, the notion of "dispatch to property" is kinda wierd to start with but it does make this kind of asymmetry which is ugly.

The justification here is that it's to defend encapsulation. Like if a base class representing, IDK, like events has a private or package private property named "class" but one subclass represents like academic classes and has its own "class" property then both properties should be able to coexist in the same object, the subclass shouldn't be impacted by name collisions with superclass properties because it shouldn't have to know about (private) superclass properties.
>>
>>62296149
Does it build and run on X86_64?

I'm taking an advanced OS class now and have kinda been hankering to hack at a toy OS
>>
>>62296080
posting a different one just to blow it for you

>>62296098
>>62296153
His answer is good but just in case you need additional reference, https://stackoverflow.com/q/9414990

The biggest reason probably is because property access would be dogshit fucking slow if it was polymorphic
>>
>>62296149
>.:02-15-05:.
>Quick and dirty update: LainOS is on hiatus for a few months more. Our project lead, Neovanglist is moving across the Big Pond and will be very unavailable for a while. Once his life has settled down appropriately we will be able to resume our Schumann and Accela development.
>Ciao,
>-Xuric
I never believed they'd finish it, but it still hurts.
>>
>>62296149
Frequently asked Questions About the LainOS Project

>This Page is still being populated and should start to see content within the next few days.
>>
>>62296167
She's not even the best slut from that show.
>>
>>62296167
>The biggest reason probably is because property access would be dogshit fucking slow if it was polymorphic
Yee, perf is the real reason, as per the norm for OO sophistry the ideological justification is wholly post-hoc
>>
>>62296166
The latest build is from 2003, the same year x86_64 was released, so it's highly unlikely.
>>
>>62296196
>The latest build is from 200
hahaha, shit. What a shame, I wanted to work on a shitty anime meme OS. I guess I'll go back to my TempleOS clone idea
>>
>>62296191
I agree m8, but I have a huge danbooru dump and it was already taking me long enough to find a face I recognized at all
>>
>>62296209
Fair enough.
Who's your best girl though?
>>
File: 1487413306014.png (383KB, 611x720px) Image search: [Google]
1487413306014.png
383KB, 611x720px
>>62296080
Lain is fucking shit. Why don't you post some animu grils that are actually cute?
>>
>>62296206
You can always contribute to RedoxOs, it's being quite actively developed, or choose another from http://www.microkernel.info/ if you don't like Rust. Contributing to an existing project would be less of a waste of time.
>>
>>62296250
hidamari is good but your answer
> Lain is fucking shit
Makes them even more shit tbqh.
>>
File: 1491942660984.png (351KB, 639x480px) Image search: [Google]
1491942660984.png
351KB, 639x480px
>>62296250
>this is the state of current /g/
Can we go back to being techloli/g/?
>>
>>62296248
>>62296248
yandere chan no contest. I'm a sucker for that type of stuff

>>62296206
Why not contribute to something like ReactOS instead of solo hobby OS projects. I think hobby OSes are worthwhile but easy to get stuck on
>>
File: Untitled.png (28KB, 764x534px) Image search: [Google]
Untitled.png
28KB, 764x534px
How is your videogame engine coming along?
>>
>>62296315
rewrite the entire thing in haskell
>>
>>62296315
>Sepples
AHAHAHHAHAHHAHAHAHHAHHAHAH
fag.
>>
>guy in class asks why nobody teaches to code in "exe"

legit question or just retarded?
>>
>>62296315
>tfw I didn't fall for the engine meme and started to develop a game right on top of OpenGL
I still abandoned it tho.
>>
>>62296337
That's what I'm doing, though?
>>
>>62296303
>yandere chan
Wut
There was a yandere?
>>
>>62296080
>>62296250

/g/ is Maki territory, all other girls need to get out.
>>
>>62296326
what language should zhe use?
>inb4 C
>>
>>62296354
C
>>
>>62296346
Why'd you make a statement into a question? Are you retarded?
>>
>>62296353
Make is a forced meme slut.
>>
File: 1407888206116.png (1MB, 1200x1800px) Image search: [Google]
1407888206116.png
1MB, 1200x1800px
WHICH PROGRAMMING LANGUAGE WOULD YOU FUCK?
>>
>>62296363
ActionScript for that hot loli action.
>>
>>62296357
C is a poorly designed language to be honest and C++ doesn't even fix C's problems but extends them.
>>
File: dlang_chan.jpg (139KB, 470x545px) Image search: [Google]
dlang_chan.jpg
139KB, 470x545px
>>62296363
<-- This one.
>>
File: anime.png (786KB, 1000x1300px) Image search: [Google]
anime.png
786KB, 1000x1300px
>>62296353
>>62296080
all anime girls are welcome

>>62296363
haskell
>>
File: cult_of_maki.png (228KB, 892x590px) Image search: [Google]
cult_of_maki.png
228KB, 892x590px
>>62296353
Suck my cock, dude.
>>
>>62296315
why are you passing a built in type (long long) by const reference?
>>
>>62296357
>no RAII
>>
>>62296363
which one of them has a benis
>>
>>62296250
>Lain is fucking shit
get out
>>
>>62296379
C is actually designed very well. If you consider C's actual goals, it does a very good job.
There is a good reason why C is so entrenched in its niche, and that no language is even close to displacing it.

>>62296398
Fuck off with your hidden state changes.
>>
>>62296396
I am writing a 32 bit program. If I passed the long long (64 bit) by stack, it would take two clock cycles. Passing it by reference ensures only a single clock cycle is needed because it's the relative address that gets passed.
>>
>>62296357
Make sure to use this with it for fun: http://libcello.org/
>>
>>62296363

Definitely Shell, would be something like this:

https://exhentai.org/g/930523/0771ea5c76/
>>
File: pvm.png (73KB, 1195x895px) Image search: [Google]
pvm.png
73KB, 1195x895px
Pic related.
>>
>>62296410
Not really true. C became popular when UNIX became popular and nothing is really going to displace C because there is so much C code that nobody wants to port to another language, especially since there aren't really many options in the systems programming space in the first place.
>>
>>62296417
>stomach deformation
yes
Yes
YES
>>
>>62296413
but it'd be std::move'd...
>>
>>62296410
>complaining about hidden state changes
>says that C is designed well
I guess you are a brainlet then if you don't understand that C also has hidden state changes.
>>
>>62296315
>currentParameters.speedMult
>(long long)
>currentTime >= ...Duration;
>allman style
>How is your videogame engine coming along?

Haven't touched it in years but I can tell you it's going better than yours
>>
File: 1501161508414.jpg (101KB, 1080x1078px) Image search: [Google]
1501161508414.jpg
101KB, 1080x1078px
>Implying there's any better language than C
>>
>>62296434
C is actually a pretty explicit language when it comes to that sort of shit.
The only code that gets generated is the code that you put there.
>>
File: 150203291620.jpg (42KB, 306x344px) Image search: [Google]
150203291620.jpg
42KB, 306x344px
Why would one want to learn how to program without desire to get a job as a programmer?
>>
>>62296334
Full retard
>>
>>62296457
To write custom tools and utilities for your own convenience.
>>
>>62296413
This is not how it works, you fail to account for the cache. It's faster to pass 8 bytes as value via stack which is likely to be in cache than to pass an address and then waste cycles actually reading the value from the memory.
>>
>>62296452
>this is what Cfags actually believe
HAHHHAHAHAH

Let me say that I actually like C, but you are delusional if you believe that. At the very least, you have a superficial understanding of C.
>>
>>62296457
Because writing programs is fun. Also, you can write useful shit for yourself.
>>
>>62296469
I actually have a very good understanding of C, and have a good idea why it's designed like it is.
How is C not explicit when it comes to state changes?
>>
>>62296469
Different anon here. Care to elaborate about C's behind-the-scenes state changes? Specifically, provide some examples that happen automatically and cause observable changes without invoking undefined behavior.
>>
>>62296484
>>62296505

Okay Mr Brainlet, explain this code for me then.

#include <stdio.h>

int array[] = {1, 2, 3, 4, 5, 6, 7};
#define LEN (sizeof(array) / sizeof(array[0]))

int main()
{
int d = -1;

if (d <= LEN)
printf("%d\n", array[d+1]);
else
printf("Fail\n");

return 0;
}
>>
>>62296410
>actual goals
What do you think count as C's design goals? The standards committee is so fucked, occult, and political asking "what are the committee's design goals" is like asking "what is the goal of abstract nationstates". The design goal of compiler design is to beat everyone else in the penis-measuring contest called micro optimizations. The design of the C programming culture as a whole is like 80% "fuck you, I'll do it my way because I know best" and 20% "I'm morally superior to everyone because I write portable assembly®!".

C as anything considered "designed" besides in the blind-watchmaker sense is a clusterfuck. As a language it just happens to be really useful.
>>
>>62296452
>C is actually a pretty explicit language when it comes to that sort of shit.
quick, tell me how many bytes are in an int!
>>
>>62296521
It prints 1
d is less than sizeof(array)/sizeof(array[0]
>>
>>62296521
That's not a state change, you fucking retard. It's you not understanding integer conversions and unsigned types.

>>62296538
Implementation defined.
That has literally nothing to do with state changes.
>>
>>62296525
Don't confuse the C standards committee with the C++ standards committee.
>>
>>62296543
Right, but did you even look at what is going on? How is -1 <= length of array false?

>>62296550
How is this any different from a state change? It's literally changing the value of an integer without being explicit.
>>
File: rel.png (338KB, 532x574px) Image search: [Google]
rel.png
338KB, 532x574px
>>62296347
It wasn't the focus but she had her moments

>>62296413
Just did a basic test on godbolt, it's one more instruction in the callee with & and many more in the caller.

// Type your code here, or load an example.
long long __attribute__ ((noinline)) foo(const long long &num) {
int foo = num*2;
return foo*2;
}
int square(long long num) {
return foo(num)+1;
}
>>
>>62296565
In that case, I will simply say that it's to prevent me from modifying the deltatime in between calls :o)
>>
>>62296521
That's an example of implicit conversion, not hidden state changes.
>>
>>62296563
>It's literally changing the value of an integer without being explicit
An integer conversion is not changing the program's state. Arithmetic and the like exist outside of the state of a program.
Writing something useless like:
int s = -1;
size_t u = 1;
s <= u;

does not change the actual state of the program.
>>
>>62296550
>Implementation defined.
>explicit language
>compiler can arbitrarily rewrite code if "undefined behavior" occurs to literally anything
>memcpy was literally undefined behavior for many years of C being in massive deployment
yeah no

>>62296562
>Don't confuse the C standards committee with the C++ standards committee.
They're both cancer, at least the C++ committee know what they are.
>>
>>62296586
>>memcpy was literally undefined behavior for many years of C being in massive deployment
is this for real?
>>
>>62296457
I am learning python because I want results asap.

I dont give a shit about programming though it is addictivly fun. I am grad student in economics and I couldn't handle anymore data entry or excel fuckery.

took me 2 days to figure out how to do 50% of the stuff I wanted.

3 months later I am just seeing the possibilities of this shit. I have wasted so much time writing papers about fully autonomous taxis/apartment buildings/vending machines that upgrade, fuel, repair, advertise themselves.

I wasted even more time creating a program that reads the dictionary to itself. And then flags all the words it doesnt say properly.

If I can figure out how to make it try to fix its phonetics and then apply this to economics as a model of self correcting market action.
>>
>>62296413
>>62296468

cache bro is almost certainly correct. Be scientific about it and actually profile your code. Disassembling or counting clock cycles isn't enough. That shit gets executed out of order, some registers depend on the state of others, sometimes that shit isn't even documented, the hardware cache has a mind of its own.

Unless you actually profile you are just guessing.
>>
>>62296563
>It's literally changing the value of an integer without being explicit.
It's not changing the value of the integer. It's just implicitly changing the meaning of the expression. No state is being modified. Either way, it's a good example of C's cancerous bits.
>>
>>62296592
Yee, see
>http://www.yodaiken.com/2017/06/26/the-c-standard-versus-c-and-the-mother-of-all-hacks/
fun read on the whole.
>>
>>62296586
>>62296550
Didn't gcc version 1.5 have #pragma stop compiling and start running a game since #pragma is implementation defined?
>>
>>62296586
>Implementation defined.
>compiler can arbitrarily rewrite code if "undefined behavior" occurs to literally anything
>memcpy was literally undefined behavior for many years of C being in massive deployment
All of those things are completely unrelated to "explicit state changes".
Stop attacking a strawman, you assblasted sepplesfag.

>>62296592
There were retards who used memcpy incorrectly, where they should have used memmove. The usage was always labelled as undefined behaviour.
glibc then changed how its memcpy implementation worked, and it broke several poorly written programs.
>>
>>62296586
>completely fails to provide an example of hidden state changes without invoking undefined behavior
Pretty predictable.
>>
File: 1499449150729.jpg (799KB, 1080x1080px) Image search: [Google]
1499449150729.jpg
799KB, 1080x1080px
I want to make love to C++-sama!
>>
>>62296565
>It wasn't the focus but she had her moments
I was thinking you meant R=L, but I wanted to make sure I wasn't forgetting a girl. Nice taste though.
Personally, my favorite girl was the insane maido.
>>
>>62296629
>>completely fails to provide an example of hidden state changes without invoking undefined behavior
>shifting goalposts to make arbitrary rewrites on undefined behavior without even a compiler warn in some cases somehow "explicit"
>>
>>62296650
By definition, a program that has undefined behaviour is an invalid C program.
Please provide a valid C program.
>>
>>62296521
The LEN has type long unsigned int.
Type cast it and the comparison works.
-1 as a unsigned int is a large number.
This is done because it makes arithmetic easier. Try calculating 5 + -1 in binary (or any number really).
>>
>>62296363
where's the bara version of this
>>
>>62296671
>The LEN has type long unsigned int
More precisely, it's a size_t.
>>
File: Untitled.png (36KB, 1002x577px) Image search: [Google]
Untitled.png
36KB, 1002x577px
>JavaScript fags will never get to feel this glorious
>>
I don't know why you guy are arguing, the argument
>RAII is bad because it implicitly change state
itself is shit. Unless you're writing in Haskell, everything changes state, and there's nothing wrong with doing some maintenance stuff like closing a file or freeing a buffer implicitly, it's much worse to expect from a programmer to explicitly do it in the correct order in all the exit paths and not to fuck up. All you have to do to see why is to look for exploits, vulnerabilities and memory leak-type bugs in C projects.
>>
>>62296650
>shifting goalposts
My post (>>62296505), to which you responded with (>>62296521) specifically requested an example of observable state changes that doesn't invoke undefined behavior. Looks like you cannot deliver, and I don't see how UD examples are relevant.
>>
>>62296665
>By definition, a program that has undefined behaviour is an invalid C program.
lol, how about you provide a valid C program (protip: if it's non-trivial you can't)
>>
>>62296711
I'm not >>62296521 I'm >>62296538
>>
>>62296723
>accuses others of shifting the goal post
>proceeds to blatantly shift not only the goal post, but also the burden of proof
You're a confirmed brainlet who doesn't understand what state changes are or how C works. Off you go.
>>
File: 1504285800907.jpg (83KB, 1200x675px) Image search: [Google]
1504285800907.jpg
83KB, 1200x675px
>all this fighting
I-I thought lolis were nice.
>>
>>62296738
Fair enough, but "that sort of shit" in his post seems to refer to something different from what you're arguing.
>>
File: 003.jpg (64KB, 411x356px) Image search: [Google]
003.jpg
64KB, 411x356px
>>62296747
>>
anyone else stare at the gorgeous haskell website wishing they knew how to use it?
>>
>>62296776
/d2g/ please stay
>>
>>62296779
if you haven't read Bird & Wadler or Leinster then haskell.org is 2l33t4u
>>
https://github.com/android-ndk/ndk/wiki/Changelog-r14
>GCC is no longer supported. It will not be removed from the NDK just yet, but is no longer receiving backports. It cannot be removed until after libc++ has become stable enough to be the default, as some parts of gnustl are still incompatible with Clang. It will likely be removed after that point.
Thank, Google.
>>
File: bully.png (57KB, 968x1624px) Image search: [Google]
bully.png
57KB, 968x1624px
>>62296801
Okay. In what programming language was the bot AI made?

https://www.f-list.net/c/ilexa
>>
>>62296807
I love GCC in concept but if I was running a business I'm not sure I wouldn't make the same decision. Clang is the better compiler desu
>>
How do I learn graphics programming?
I want to get into glsl and maybe vulkan later but everything I menage to find is some c++ bullshit.
Is there any way I could learn that without getting back to some shitty tutorials that want me to install IDE's and shit like premake to do the work?
Any simple way? There has to be some
>>
>>62296723
int main(void) { }

Before you complain about the lack of return 0;, since C99, it's implied.
>>
>>62296828
Why do you love gcc in 'concept'?
>>
>>62296807
>Using cuck-licensed software
No thanks.
>>
>>62296807
It's not even the recent changelog,
https://github.com/android-ndk/ndk/wiki/Changelog-r16-beta1
>libc++ is out of beta and is now the preferred STL in the NDK. Starting in r17, libc++ is the default STL for CMake and standalone toolchains. If you manually selected a different STL, we strongly encourage you to move to libc++. For more details, see this blog post. TODO: Create blog post.
>TODO: Create blog post.
Has anyone used clang's libc++? Is it any different from GNU libstdc++?
>>
>>62296836
It's a free (soon to be former?) commercially viable compiler with backends straight to assembly (as opposed to the LLVM intermediate representation). I think that's a beautiful thing, that's that compilers were supposed to be in my day of compiler design. Nowadays everyone has bytecode or an LLVM backend, it may be the way of the future but it isn't as beautiful as it once was. We lost moral clarity in compiler design.
>>
>>62296521
/~/test$ gcc -Wall -Wextra test.c && ./a.out 
test.c: In function ‘main’:
test.c:10:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (d <= LEN)
^
Fail

What is confusing to you?
>>
>>62296884
Go doesn't use llvm or bytecode to compile, however it does have a gcc frontend with gccgo.
>>
File: Gcc.jpg (26KB, 748x305px) Image search: [Google]
Gcc.jpg
26KB, 748x305px
>>62296884
> It's a free (soon to be former?) commercially viable compiler with backends straight to assembly (as opposed to the LLVM intermediate representation)
You have no idea how gcc works, do you? It too uses intermediate representation, it's just shittier than LLVM's bytecode and harder to work with.
>>
Why does everyone use clang now?
>>
File: gcc_clang_authors.jpg (148KB, 1497x691px) Image search: [Google]
gcc_clang_authors.jpg
148KB, 1497x691px
>>62296910
Go uses its own NIH assembler, which is quite bad: http://dtrace.org/blogs/wesolows/2014/12/29/golang-is-trash/ .
>>62296917
It's easier to use, faster, and the resulted code is as performant as gcc's. Plus it's being sponsored by big companies, meaning it has more developers working on the project.
>>
>>62296911
So what? The internal representation isn't something that's exported to another project. GCC is the project responsible for every line of assembly/machine code it produces. When LLVM frontends don't like something about LLVM they raise a ticket, politick, or fork. These are all pretty shitty options. GCC does not have this problem.
>>
>>62296956
> So what?
So your statement was factually incorrect.
> GCC is the project responsible for every line of assembly/machine code it produces
Clang/LLVM are parts of the same project too.
> GCC does not have this problem.
There're several compilers that use GCC's backend, it's not unheard of, it's just harder to do than with LLVM.

In other words, architecture-wise Clang/LLVM isn't that different from GCC, it's just better at it.
>>
File: gg.png (88KB, 1514x1122px) Image search: [Google]
gg.png
88KB, 1514x1122px
>>62296315
its coming along :DDD
>>
>>62296997
>all these macros referencing variables from the current context
C-tards will defend this.
>>
>>62297020
No. Every C style guide I have seen points out that macros relying on local variables are generally terrible.
>>
>>62297020
They seem to just be referencing global variables...
>>
>>62296917
Big companies are free to use it because the license is too permissive
>>
>>62297111
But LGPL is permissive as well, isn't it?
>>
>>62297153
LGPL doesn't let you cuck others as much.
>>
>>62297157
>>62297153
Also, I should note that GCC is GPL (with exceptions)
>>
I find programming in C# on windows with visual studio extremely comfy. However I dislike running windows on my thinkpad. Whats a good programming language that feels a lot like C# that I can program with on linux? I don't like using mono because I feel like I'm missing a lot of the windows specific functionality that C# and visual studio integration supplies. Here are some things I like about C#.

>its easy to program in and has lots of support for it, a very beginner friendly language
>strict typing, not duck typing
>bracket based code scoping
>strings are easy to work with

Things I don't like from languages I've tried (my likes don't implicitly mean I dislike the opposite so I'll be explicit).
>duck typing
>(one table/dict/array/everything) type languages. I'll use lua as an example, I dislike it when a language has ONE data structure for everything that doesn't have strict typing.
>complicated process for compiling/linking code for a beginner (I'm too low IQ for c++ and its many libraries and versions)

I'd like to find something with a simple graphics and window library because I dream of making shitty games for myself.
>>
File: debconf-blackduck.png (48KB, 1000x662px) Image search: [Google]
debconf-blackduck.png
48KB, 1000x662px
>>62297111
This is why GPL is dying and MIT is the future of FOSS.
>>
>>62296997
>>62296315
Do I need any graphical objects to make a game engine?
>>
>>62297184
No if you're making a terminal engine.
>>
>>62297173
Vala, but it's practically dead.
>>
>>62297173
C# and Java are basically the same.
>>
>>62297205
More like modern Java is basically C# from ~2005, but with shittier generics.
>>
>>62297218
True enough. But has C# added anything useful in that time?
>>
>>62297182
The future doesn't is bleak
>>
>>62297231
Yeah, a lot of stuff, some minor and some pretty major like LINQ and async/await: https://en.wikipedia.org/wiki/C_Sharp_(programming_language)#Versions .
>>
>>62296062
#include <stdio.h>

int main(){

int c = 5, d;
d = ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c;

printf("%d\n", d);

return 0;

}


How much is d?
>>
>>62297190
Thats what I thought. I kinda wanna try it for fun to see what I could do
>>
thoughts on spec based tests?
example:
describe Math do
describe "multiply()" do
it "should multiply parameters" do
assert_equal 4 Math.multiply(2, 2)
end
end
end
>>
>>62297264
>not using dependent types to formally prove your code
You're like a little baby.
>>
>>62297255
UB
>>
>>62297218
I don't like using generics, I'm a bad programmer, will Java fit me like a glove? I've never tried it because my friend that uses C# at work shit on it and all I've heard from C and C++ programmers is bad stuff. I tried Python and hated it, tried Lua and hated it, tried C and kind of liked it until I started doing anything that wasn't trivial, I got super confused and lost using c++ because there was 1,000 books and all the videos and talks and tutorials for modern c++ started with 5 episodes of setting up an IDE/Editor and libraries and shit and then began with super hard to read generic programming with tons of weird operators and shit. I liked C# because I watched the Bob Tabor series and it was maximum comfy and intellisense and MSDN were always there ready to hold me like a new born baby.

I'm going to try Java. I have an odd feeling that everything people hate about Java will be shit I like because I'm fucked up and bad.
>>
>>62297252
>LINQ
lmao you mean those half assed baby tier iter tools?
>>
>>62297293
Don't worry, Java was designed so that even Pajeets could program.
>>
>>62297293
If you can write C#, you can write Java.
>>
>>62297302
>he thinks LINQ is just a bunch of methods for FP-like iteration
It's much more than that, go learn about Linq to SQL.
>>
>>62297255
139
>>
>>62297327
>It's much more than that
Yeah I know they are broken too
>>
>>62297276
Does Haskell have dependent types? I don't think many languages have dependent types, at least no note worthy ones other than Idris.
>>
C++ 17 approved today lads.

Anything interesting in there? General sentiment appears to be that the cool stuff got pished to 20 and 23.
>>
>>62297315
Alright, that sounds good then.

>>62297319
I can write shitty C#. I don't use LINQ, or lambdas, or events, I barely use inheritance. I basically use C# as some sort of class based compiled scripting language where I crutch on intellisense and the WPF editor if I want a GUI.
>>
>>62297345
They are working on it, but I mostly meant Idris or Coq.
>>
>>62297349
Some new stuff in STL I guess.
>>
>>62297374
Yeah I'm struggling to get excited because at work we have no way of bumping the compilers up. So I wouldn't get to play with the new toys anyway.
>>
>>62297349
>C++XYZ+3 with finally m-make that language g-good, r-right guys?
Sepplesfags are pathetic.
>>
>>62297349
I wanna try `if constexp`, it should simplify template memeprogramming somewhat.
>>
>>62297393
Language is fine.
>>
>>62297302
more like baby's first monads
>>
>>62297428
It's messy as fuck but at least it's usable since C++11.
>>
>>62297349
waiting on ranges
>>
>>62297338
yea, linq basically copies everything all the time
>>
>>62297349
>Clang still doesn't support slicing maps and sets
lmao
>>
>>62297443
Anything that boost doesn't offer?
>>
>>62297472
never
>>
>>62296363
>scala
>ruby
>php
>c#
>actionscript
tfw no programming gf
>>
I hate learning new things so I was wondering I could use C for everything I will do (mainly small games and back end web dev), also what is a javascript-free version of captcha.
>>
>>62297349
i really only care about modules at this point
did they cut it?
>>
>>62297590
yes
>>
>>62297592
Gotta wait until C++20.
>>
>>62297590
>I was wondering I could use C for everything I will do
Yes, but I don't think you'll like it
>>
>>62297592
Modules aren't going to happen, dude.
You are looking for D
>>
>>62297596
yay thank you (o^â–½^o)
>>
I have a script and running in the backend like "ABC.script" and it's arguments are taken from frontend like "-a 12 -b 34". The command which will run on the server is "ABC.script -a 12 -b 34". The user cannot see the whole command running on the server. How many ways are there to break this apart from below?

User configures ";rm -rf;" in frontend
>>
>>62297349
I like it, I just wish there was an easier way to integrate the third party frameworks like we have in python (pip install xyz; using xyz)
>>
Why use make when you can use rake?
>>
>>62297605
> You are looking for D
No one is looking for D.
>>
>>
>>62297631
Enjoy nomodules.jpg then
>>
>>62297605
If I'm using C++, I don't want a GC.
>>
>>62297639
But you want reference counting
>>
>>62297601
ohhhh (ᗒᗣᗕ)՞ what else do you recommend I 'hurd' python was good.
>>
>>62297616
Pretty sure they are leaning into cmake. It's not as easy as pip install, but it's more powerful. Being based in C, I expect nothing less.
>>
>>62297644
No you don't you fucking retard.
Reference counted freeing is bad for performance.
>>
>>62297644
No I don't, shared_ptr a shit.
>>
>>62297661
In which case you would be writing C
>>
>>62297587
such is life of a C/C++ tard
>>
>>62297632
ayy that's me, I do a ton of vehicle interfacing in C++. Albeit in mining equipment.
>>
>>62297683
>>62297627
>>
>>62297672
RAII is zero-cost.
>>
>>62297656
lol
>I want to write games and do webdev
>What language
>>
>>62297672
>std::unique_ptr and move semantic is C
D-tards are so funny when they try to shill their useless language to C/C++/Rust no-GC crowd.
>>
>>62297683
shose are system libraries found in any POSIX conforming operating system.
>>
File: rockingit66_1501978543958.jpg (64KB, 750x1334px) Image search: [Google]
rockingit66_1501978543958.jpg
64KB, 750x1334px
Python
>>
>>62297702
>:unique_ptr
https://dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/
>>
>>62297711
>>62297690
>>
>>62297632
That shit looks autistic af
>>
Really disappointed that we still have no real way to convert enums to strings, back and forth. Especially since the introduction of constexpr makes this a purely syntactic sugar.
>>
>>62297701
Games like tetris for the terminal ( all the existing ones have an issue where it will repeat a block a bunch)
>>
>>62297768
C is good for learning. You are forced to learn about memory management.
>>
>>62297719
It's like you have an attention span of a goldfish. No one said you can't do it in D, the point was that C++ without reference counting is still far ahead of C in terms of memory management, and can be used quite comfortably without compromising run-time performance in any way, be it reference counting or GC.
>>
>>62297659
Does cmake/make get rid of the whole "linking/preprocessing" nonsense you have to do with C++?

For the longest time, I've avoided using C/C++ due to complexity of using third party libraries and the uniqueness on setting up third party libraries on every project I've worked with.
>>
>>62297887
>complexity of using third party libraries
Only if you're a stupid winmemer.
Using libraries is easy as fuck on GNU/Linux.
>>
>>62297692
Ur mum is zero-cost
>>
>>62297976
BTFO
>>
>>62297612
`rm -rf /` will also work
>>
File: 800px-Edsger_Wybe_Dijkstra.jpg (249KB, 800x1067px) Image search: [Google]
800px-Edsger_Wybe_Dijkstra.jpg
249KB, 800x1067px
>It is practically impossible to teach good programming to students that have had a prior exposure to $language_name: as potential programmers, they are mentally mutilated beyond hope of regeneration
Basic being irrelevant nowadays, what would you use for $language_name?
>>
I've started learning JavaScript in an attempt to maybe get a job with it in the future. I'd also like to.be able to make games in the future, what should I learn for that? Is there a language I can learn that'll give me job prospects and the ability.to make a game?
>>
>>62296363
Perl has a penis
>>
>>62296315
>visual jewdio
not allowed on this board
>>
>>62298073
javascript
>>
>>62298073
C or Haskell
>>
>>62296363
probably R or scala
>>
>>62298097
C, possibly. Haskell, no.
>>
>>62298089
Too obvious.
>>62298097
>Haskell
Only in a sense that after Haskell everything seems so shit you don't wanna touch it.
>>
>>62298073
C++, Java, Microsoft Java, memesnek.
>>
>>62298108
>>62298104
haskell babbies triggered that their language is unusable
>>
>>62298075
Sadly, that's probably C++, Java or C#
>>
>>62298122
The quote is not about usefulness tho, it's about causing long-term mental damage.
>>
>>62296062
OBJECT ORIENTED MATLAB.
>>
>>62298148
I didn't say "useful" or anything related to that, I said "unusable". "usable" != "useful". Learn to speak properly.
>>
>>62297632
this photograph is severely damaging to my mental health
>>
I have a question for y'all.
I am working on a program used to move many smaller (between 2 and 20mb) files from one device to another in java.
Right now I'm moving each file individually using a buffered I/O stream. I was wondering if there wasn't some way to optimise this and move them all as a single large file instead of and then separating them at their destination.

I'd be thankful for any input on this idea from anons with some knowledge on the topic.
>>
>>62298396
Just use tar or zip with no compression.
>>
does anyone have any tips for parsing strings in c?
I generally tokenize the string, make a vector out of it then go through a state machine.
I'm wondering if there is a better way?
>>
>>62298440
Yes, use flex+bison.
>>
>>62298122


&#160;&#160;â–²
â–² â–²
>>
File: serveimage.jpg (106KB, 1024x683px) Image search: [Google]
serveimage.jpg
106KB, 1024x683px
>>62298422
Shit. Its so obvious.
>>
>>62298440
There are libraries that do that for you, also there are lex&yacc that generate parsers. But in general, they do the same thing you do. If you are writing C-not-++, i'd recomend lex&yacc. Anyway, writing your own parser is probably better, because it's a fucking disaster to debug autogenerated parsers
>>
>>62298456
you done goofed
>>
>>62298453
>>62298482
thanks, I have looked at flex in the past, but I was put of as it seemed a bit ungainly. are there any books you'd recommend?
>>
File: images.jpg (125KB, 822x1080px) Image search: [Google]
images.jpg
125KB, 822x1080px
>>62298504
It's quite short.
>>
>>62298524
>draw a birb
>call it a bison
Why is this allowed?
>>
>>62298570
These are their personal names.
>>
I want to write a computer virus that ensures only a single copy ever exists. When it makes its way into another computer system, it deletes the old copy. Then, it pings a server i set up so i can see where she is in the world at the moment. Whenever she dies, i release another one and see where she goes
>>
File: Renamon.full.1595179.jpg (129KB, 593x615px) Image search: [Google]
Renamon.full.1595179.jpg
129KB, 593x615px
>>62298733
Writing viruses is not very nice, senpai
>>
>>62298570
what's a flex
>>
>>62298833
What programming language is this?
>>
Thoughts?

func _process(delta):
if (path.size() > 1):
var to_walk = delta*SPEED
while(to_walk > 0 and path.size() >= 2):
var pfrom = path[path.size() - 1]
var pto = path[path.size() - 2]
var d = pfrom.distance_to(pto)
if (d <= to_walk):
path.remove(path.size() - 1)
to_walk -= d
else:
path[path.size() - 1] = pfrom.linear_interpolate(pto, to_walk/d)
to_walk = 0

var atpos = path[path.size() - 1]
get_node("agent").set_pos(atpos)

if (path.size() < 2):
path = []
set_process(false)
else:
set_process(false)


func _update_path():
var p = get_simple_path(begin, end, true)
path = Array(p) # Vector2array too complex to use, convert to regular array
path.invert()

set_process(true)


func _input(event):
if (event.type == InputEvent.MOUSE_BUTTON and event.pressed and event.button_index == 1):
begin = get_node("agent").get_pos()
# Mouse to local navigation coordinates
end = event.pos - get_pos()
_update_path()


func _ready():
set_process_input(true)
>>
>>62296315
>C style casts
What the fuck are you doing?
>>
>>62296410
>Fuck off with your hidden state changes.
I guess you should stop using C then.
>>
>>62298984
Programming. What does it look like I'm doing?
>>
>>62299020
It looks like you're being fucking retarded.
Use static_cast. NEVER use C style casts.
>>
>>62299066
why
>>
>>62299065
>daily programming thread
>why can't any of you compose music
>>
Can I use select / poll with FILE* ?
>>
>>62299126
No, you need file descriptors, i.e. ints returned by open, connect or accept. But you really shouldn't be using select or poll unless it's educational, they're suboptimal, epoll is the recommended way to do event-based IO.
>>
>try codeblocks
>it keeps compiling and running my old file
how tedious
>>
>>62299166
So if I want to read lines at time, I will have to buffer the output of read?
>>
>>62296062
Solving a USACO problem about Wormholes.
>>
>>62299078
Because they're shit.
It's not clear whether it will convert the value or reinterpret the bits of the value.
In C++, always use either dynamic_cast, static_cast, or reinterpret_cast.
dynamic_cast is for casting up or down the inheritance tree at runtime using RTTI.
static_cast is for type-safe conversions from one type and another type, if they're compatible.
reinterpret_cast simply re-interprets the bits as another type, and performs no conversion whatsoever.

C++ style casts are always better, as they are more explicit and type safe.
>>
What's the dpt verdict on Visual Studio 2017?
>>
>>62298914
Let it be Clojure!
But actually it's a renamon
>>
>>62299241
every version of VS is better than the last
I haven't tried 17 yet
but they have a flawless track record of improving this particular product, so I recommend it
>>
>>62299203
I guess you can open a file with `open`, then get FILE* with `fdopen`, which is defined not in the C standard but in POSIX, register the original fd with epoll and then read from FILE* when events come. I'm not sure it'll work tho.
>>
>>62296410
I see you haven't heard of Rust.
>>
>>62299192
Ah, gotta rebuild it first
>>
>>62299241
VS is the best IDE out there, but I have neither need nor interest to develop for Windows, so I'm stuck with spacemacs.
>>
File: 1498752536390.jpg (98KB, 608x395px) Image search: [Google]
1498752536390.jpg
98KB, 608x395px
How do I program an AI girlfriend?
>>
>>62299343
use lisp, obviously
>>
>>62299343
With a computer
>>
>>62299343
Start by learning x64 Assembly, then move onto writing binary machine code.
>>
>>62297173
You don't have to use Mono to use C# on Linux.

.NET Core 2.0 is out; it checks all of your boxes for your purposes, mostly likely.

http://www.omnisharp.net/
>>
Can someone explain how much quicker a program would be if created in the following languages. My understanding is that the order from fastest to slowest would be:
>1st ASM
>2nd C
>3rd Python
But how much faster? Let's say the task was parsing 500 text files
>>
Does anyone here know of a tool or a compiler option, that would, given a c struct definition, tell me exactly how it's laid out in memory?
>>
>>62299711
Python will always be the slowest
C vs. ASM, depends on how good the ASM dev is
>>
>>62299711
shit bait
>>
>>62299241
It didn't change a large number of things the average hobbydev would care about, but it does have some nice additions. Specifically, the new installer that makes it way more clear as to what you're actually installing, and all of the Azure integration points.

Also, the roaming extensions are somehow overlooked by a lot of people, but it's a godsend if you move machines.
>>
>>62299711
500 files each with 30 characters of text? about the same for all 3
if it's a substantial amount of text and complicated parsing is involved, then see
>>62299737
>>
>>62299711
> the task was parsing 500 text files
ASM ~= C, but most likely slower than -O3, because modern compilers are quite good at using all the possible ways to optimize the code for recent CPUs with thousands of instructions, MBs of cache and complex branch prediction rules, something no human being is able to do.
Depending on the complexity of the parsing involved, Python could be anywhere from x1.5 to x10 times slower. If the parsing is primitive, the time spent on disk access would dominate the total time and the language used would make little difference.
>>
How do I get something like clangs -fsanitize=undefined in gcc?
>>
I have a dataset of ~5mil records in ~7000 csv files. I've already loaded them into a MySQL database, but I realized that I don't actually need to search the dataset very frequently - I'm probably best off just loading it all into memory at the start of my (Java) program. Would it be faster to load it all from the database with JDBC or to just read it from the csv files?
>>
>>62299897
>His language requires """sanitizers""" to provide basic safety checks
>These checks are performed at run-time
Sad!
>>
>>62299926
>I'm probably best off just loading it all into memory at the start of my (Java) program

Let the database do the heavy lifting when it comes to searching and combining that data with other tables. RDBMS's are insanely optimized for these things.
>>
>>62299819
>python can be anywhere from...
Anon look at toy-program benchmarks.
Last I checked it varied between 35-200x slower for python compared to C implementations (and those python implementations were UGLY).
Real world performance i don't know. But can we expect it to favor python more than benchmarks which are written without regard for common python patterns and convenience? Probably not.
I agree completely on your statement on asm vs C. It's important to mention.
>>62299711
But it's worth noting that for the particular task C and ASM are very likely to be poor choices for parsing text files. Theoretically you absolutely don't lack performance in either of those but in practice writing C/ASM text parsers is very hard to do efficiently. It wouldn't surprise me if languages like C++, D and even Java have an advantage in real-world text parsing.
>>
>>62299967
It's just one table, is the thing.
>>
>>62299980
you're talking about benchmarks of computationally intensive algorithms
most file io is very basic and not even 2% as cpu intensive as those tests
>>
>>62299980
>Anon look at toy-program benchmarks.

> If the parsing is primitive, the time spent on disk access would dominate the total time and the language used would make little difference. If the parsing is primitive, the time spent on disk access would dominate the total time and the language used would make little difference. If the parsing is primitive, the time spent on disk access would dominate the total time and the language used would make little difference. If the parsing is primitive, the time spent on disk access would dominate the total time and the language used would make little difference. If the parsing is primitive, the time spent on disk access would dominate the total time and the language used would make little difference. If the parsing is primitive, the time spent on disk access would dominate the total time and the language used would make little difference.
>>
>>62299951
Yes. It is sad. But I'm very happy to have the tools clang provide
>these checked are performed run-time
Not all of them.
>>
>>62296363
C++ all day, all night
>>
>>62298075
C++ mate
>>
File: lang-gdscript-demo.png (105KB, 770x634px) Image search: [Google]
lang-gdscript-demo.png
105KB, 770x634px
What does /g/ think of GDScript?
>>
>>62300087
no
>>
>>62300002
>>62300005
If you're doing parsing that's actively bounded by disk access (like memory mapped IO random access), yes that's true.
But for parsing 500 text files you don't need to do slow synchronous disk io. Passing files on disk not a throughput bounded task it's a latency bounded task.
We're not given the size of the files at all of course. But if they're of any measurable length and/or complexity of parsing the IO time shouldn't be that bad.

Also, while anon did give the task of parsing files he's not exactly giving me the vibe that he's looking for the disk IO differences here. He seems like a person who's looking to understand when to apply ASM, C and python respectively.
I say you choose python when performance isn't a concern. If you have a bounded set of files to parse then yes python is probably a good choice compared to the other two. You don't care if it takes a couple ms or a couple seconds. Maybe you'd even tolerate a minute for this. Python works there.
>>
File: rangeslider2.png (12KB, 250x200px) Image search: [Google]
rangeslider2.png
12KB, 250x200px
Can I make a slider with multiple handles like pic related in python, using Tk or some other GUI library? Actually I'd prefer even more handles (pairs of 2 with some marking in between)...
Right now I'm doing this with pygame, but combining pygame and Tk (since I need popups and shit) is a major PITA, and doing everything in pygame is also a lot of work (shitty text drawing etc..).
Any ideas anons?
>>
Yard hostler for amazon- weekend only- guy who moves trailers around
>>
>>62296363
Ruby or JS.
>>
File: multi slider.jpg (11KB, 810x65px) Image search: [Google]
multi slider.jpg
11KB, 810x65px
>>62300151
This is basically what I mean. All examples I found so far use jquery.
>>
>>62297349
personal favorites:
constexpr if
easier to nest namespaces
structured bindings
optional, any, variant
standard fs lib
>>
Is it possible to make transparent windows using opengl on linux?
I know that it's simple on windows but can't find anything that could help me figure it out on linux
Any help is appreciated
>>
>>62298479
kek
>>
Are websites like Codecademy and Dash good for beginners? Any books to read if those sites aren't good?
>>
>>62298914
Visual FoxPro
>>
>>62300545
All you will ever need is thenewboston:

https://thenewboston.com/videos.php
>>
>>62300494
OpenGL has nothing to do with it, you need to use the X11 API to make the window transparent first.
>>
opengl sucks though
>>
Wtf i have ti find all occurrence of all words of a list in python

I tried several solution but nothing works

The words of the list are taked from a text file and splitted .split(" ")
>>
>>62300577
So after creating that transparent window I can print stuff on it with OpenGL?
Must say this might be a dumb question but I always used some simple library for gui work, just wanted to make a transparent application this time, sorry if it's retarded
>>
>>62300630
do you need an exact position of each occurence?
>>
>>62300794
Nope
>>
>>62300630
I tried to do this, did I understand it right?
use std::collections::HashMap;

fn occurences(txt: &str) -> HashMap<&str, Vec<usize>> {
let mut occur = HashMap::new();
for (line, word) in txt.lines().enumerate() {
occur.entry(word.trim()).or_insert_with(Vec::new).push(line);
}
occur
}

const TXT: &str = "foo
bar
baz
bar
foo
quux";

fn main() {
println!("{:?}", occurences(TXT));
}

Output:
{"quux": [5], "foo": [0, 4], "bar": [1, 3], "baz": [2]}
>>
>>62301016
Then maybe just create an empty dictionary, iterate through all your words, compare it to keys and if it doesn't exist create a key with a value of 1, if it does just += 1?
>>
>>62301063
>>62301016
like
counted_words = {}
for word in words:
if word not in counted_words:
counted_words[word] = 1

else:
counted_words[word] += 1
>>
>>62301029
you missed the part where it says python
>>
>>62301153
I'm not gonna do his homework
>>
>>62301165
then why bother posting at all
>>
>>62301178
This is the daily programming thread. Why shouldn't i be posting code?
>>
>>62301029
btw i solved the problem using Counter(), previously i had a problem with list "Python: TypeError: unhashable type: 'list'"
>>
So I've transferred unis and at my last one we learned Java all the way to gui stuff, databases, etc.

But now my new school did all that in python, and for my first cs class here in the spring I'll be expected to know how to do everything in python. I know basic python syntax, but does anyone have any recommendations for catching up? I'll be doing it on Linux so no windows only tutorials or some dumb shit
>>
>>62296062
Is game development a good method to improving skills? I'm not really all that into games or anything, but I saw ADGD on /vg/ and I guess it'd be a cool project to work on and see grow. Only thing is reading through the thread it seemed a few of them were using game engines while having not much knowledge of programming really, or missing certain basics. anyone have experience? Is gamedev a good way to get gud?
>>
>>62301330
i start practicing python today (im the one of the occurrence problem), i suggest you to watch derek banas learn python in one video and then start doing 4chan programming challenges
>>
>>62301437
Game development requires a very diverse skill set. Even your generic platformers take a lot of work. It is a very good way to expand your skill set, but due to the need for more than just code a lot of people never finish their projects.

If you feel like you want to do it, learn the basics of whatever you'll use to build your game, and then try to make everything on your own, and then look up best methods for what you made and refactor with that best method in mind.
>>
>>62301437
Its alright. Throughout my ""vast""" programming career of the past three or four years I've done nothing but games/game engines. I'm certainly pretty confident with C and C++.
I will not how ever that generally, I don't think using a premade engine will teach you that much if you really want to improve as a programmer. Doing engines, even simple 2D ones, provides a lot of opportunities to learn new things though.
>>
graduating in december and my programming skills are absolute garbage. at best I could hack something together, but I'm not happy with that. It sickens me that I will have a degree in software engineering and I don't deserve it. somebody help me. point me in the right direction. do I need to start coding every waking extra second of my life? do I start an ambitious project and stick to it?
also I will say to anybody that ever feels bad about not going to school / having a degree - trust me the degree doesn't mean shit most of the time
>>
why is this thread perpetually full of total beginner shitters
>>
>>62301568
>degree in software engineering
>doesn't know how to program

what the fuck have you been doing for the past four years?
>>
>>62301586
I know how to program. I'm just really bad at it. I can write fizzbuzz. I can hack shit together. I could probably even worm my way into a job. but I'm not satisfied with myself. I've started at least 50 different side projects in the last four years that went nowhere. All of my experience comes from school projects. I worked on backend for a website in one class, a lot of C programming for OS and networks, a lot of java enterprise type shit for several of my software engineering classes, and that's about it. I don't feel as if my skills are up to par with where they should be anyways.
>>
>>62301577
As people advance they generally have less reason to post since they have no questions to be answered here, and they also don't feel the need to show off their skills as much as beginner/early intermediate programmers often do.
>>
>>62301568
95% of software eng/cs graduates can't program at all
it's well known in the industry
>>
New thread:

>>62301784
>>62301784
>>62301784
>>
http://www.emulator101.com/diving-in.html
http://www.emulator101.com/reference/8080-by-opcode.html

This guy says here that on 8080, little endian is used.Ok.

But let's take for example
00 00 00 c3 d4 18 00

he says that its:
NOP
NOP
NOP
JMP $18d4
NOP

Why are d4 and 18 reversed after c3?
>>
>>62301829
little endian means least significant byte is first
18 is the least significant byte, so it goes before d4
>>
File: Heh.png (2MB, 2830x2198px) Image search: [Google]
Heh.png
2MB, 2830x2198px
What causes this to happen when I'm resizing my window in OpenGL?
The texture is drawn on a framebuffer which is generated with the window's initial width & height. When I resize the window I call glViewport(0,0,newWidth,newHeight)
Do I need to re-generate the framebuffer with the new width & height everytime the window is resized, even though I just want to up/down-scale it?
new to this pls no bully
>>
>>62302133
i don't know but this looks like higer level of meme
>>
>>62302133 (You)
Resizing the frame buffer worked. However is it really necessary?
>>
Anyone who can help me out?

var brickRowCount = 3;
var brickColumnCount = 5;
var brickWidth = 75;
var brickHeight = 20;
var brickPadding = 10;
var brickOffsetTop = 30;
var brickOffsetLeft = 30;

var bricks = [];
for(c=0; c<brickColumnCount; c++) {
bricks[c] = [];
for(r=0; r<brickRowCount; r++) {
bricks[c][r] = { x: 0, y: 0 };
}
}

function drawBricks() {
for(c=0; c<brickColumnCount; c++) {
for(r=0; r<brickRowCount; r++) {
var brickX = (c*(brickWidth+brickPadding))+brickOffsetLeft;
var brickY = (r*(brickHeight+brickPadding))+brickOffsetTop;
bricks[c][r].x = brickX;
bricks[c][r].y = brickY;
ctx.beginPath();
ctx.rect(brickX, brickY, brickWidth, brickHeight);
ctx.fillStyle = "#0095DD";
ctx.fill();
ctx.closePath();
}
}
}

Im learning javascript, at var bricks I dont understand what it does exactly, and when var bricks is used in drawBricks i dont really understand the use of having it there. It seems like function drawBricks would work just fine without the bricks[c][r].x = brickX;
bricks[c][r].y = brickY;
part
>>
>>62303492
I should also mention the result of this piece of code is a 5x3 lineup of bricks
>>
>>62303514
var bricks is an empty array that gets filled with bricks.
Thread posts: 327
Thread images: 38


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