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

File: 1482013529967.jpg (1MB, 3537x3335px) Image search: [Google]
1482013529967.jpg
1MB, 3537x3335px
Old thread: >>61806259

What are you working on, /g/?
>>
>>61806387
i think you need to diversify yourself more anon
>>
File: rightclick-polymorphism.webm (2MB, 800x608px) Image search: [Google]
rightclick-polymorphism.webm
2MB, 800x608px
>>61806360
Minecraft clone. Added polymorphic behavior to right clicking last night. Working on macros for creating new blocks easily right now.
>>
File: 1453302937201.png (356KB, 386x557px) Image search: [Google]
1453302937201.png
356KB, 386x557px
>>61806437
Why haven't you posted code yet? It looks quite interesting.
>>
Pickle Rick simulator in VR with Unity/C#
>>
>>61806521
The 'A' one relies on chars being ASCII.
>>
>>61806511
Why do you want to steal his code?
>>
>>61806563
Forgot to add in parenthesis (Assume the character set is ASCII)
>>
>>61806437
Why make dis?
>>
>>61806360

Daily reminder that god's temple must be perfect
>>
>>61806575
I don't want to steal it. I'm curious as to how scheme is being used and how it interacts with C.
>>
>>61806526
Rick and Morty is a normie meme, please return to Reddit.
>>
I use Python to write a bunch of web scrapers and shit and some toy stuff like scripts for displaying graphics in the terminal for desktop thread screenshots

I bought K&R and started going through it and am so shit at programming. Should I even keep going? I'm stuck on this fucking reverse polish notation calculator but I wrote it in Python in like five minutes.
>>
>>61806677

Maybe read an actual C tutorial book and not a reference book.
>>
>>61806712
But http://fabiensanglard.net/c/index.php
>>
>>61806754

It is the best text on C, but it's a reference text for most people. Trying to learn from it if all you have been exposed to is python scripts, you may struggle and think you're retarded. And you may be, but give yourself a fighting change.
>>
>>61806511
I post snippets of it all the time. I'll release it in due time.

Here's what I wrote today:
(define-syntax make-block
(syntax-rules ()
((_ name constructor methods ...)
(begin
(define name constructor)
(hash-table-set! block-table (quote name) name)
(make-block-class name methods ...)))))

(define (partial-capture macro captured)
(er-macro-transformer
(lambda (expr rnme cmpr)
(append (list macro captured) (cdr expr)))))

(define-syntax make-block-set-verbose
(syntax-rules ()
((_ (slab-upgrades full half player-place! slab-player-place!)
name name-slab (constructor args ...))
(begin
(make-block name (constructor full args ...))
(make-block name-slab (constructor half args ...)
player-place! slab-player-place!)
(set! slab-upgrades (cons (list name-slab name) slab-upgrades))))))

(define-syntax make-block-set
(partial-capture
'make-block-set-verbose
'(slab-upgrades fullblock_model halfblock_model player-place!: slab-player-place!)))

Here's it in use:
(make-block-set stone stone-slab (make_ultrabasicblock SOLID blocksheet #f 1 0))

This macro will get more and more useful (and longer) as I add different block shapes that you'd want to define at once (stairs, fences, etc.)

And this was what I posted last night >>61791966

>>61806617
Why not?
>>
>>61806360
nodejs thermostat with logging and graphing of system efficiency.
>>
>>61806360

Nothing. Sitting here bored to tears dreaming about finally having an idea that will make money instead of actually doing something about it.
>>
File: cat on CRT 4.jpg (2MB, 2448x3264px) Image search: [Google]
cat on CRT 4.jpg
2MB, 2448x3264px
i have a multi-dimensional JSONArray in Java, whats the best way to transform it to a set of atoms? eg, i want to take JSONArray "[[1,2],[2,3]]", and produce HashSet {1,2,3}, without spendinging an hour writing and debugging it.

ive been spoiled by better languages and juggling types from JSONArray to Array<String>[x,y] to Array<String> to HashSet<String> seems fucking retarded to me.
>>
What am *I* working on?? Hahahahahhaha
>>
Reduced the number of shift/reduce conflicts in my parser from 12 to 1 with the magic use of parentheses.
>>
Would you guys pick a single thread and stick to it?
>>
File: MookIsACunt.jpg (6KB, 245x33px) Image search: [Google]
MookIsACunt.jpg
6KB, 245x33px
So js does pic related when i want to print the hex representation of a float.

Except 10.8 float is stored as 0x412ccccd, how can i get this instead of a.cccccccccd??

Also why do we have code tags when i cant even post a simple code like pic related?
Fuck you Mook.
>>
>>61806360
I'm working on figuring out why you posted this when the "old" thread only has barely any replies you fuckin doofus.
>>
>>61807194
>Also why do we have code tags when i cant even post a simple code like pic related?
var x = 10.8;
x.toString(16);
>>
>>61807258
Shit, I didn't realise I linked the wrong thread.
It's pre-bump limit /pol/ shit and is invalid. I wish the janitors would get off their asses and delete it.
>>
>>61807287
how

>>> var x = 10.8;  x.toString(16);

"a.cccccccccccd"
>>
>>61807325
how what? How did I put code in a code tag and hit post?
>>
WTF?
Stackoverflow is sensoring comments?
>>
>>61807325
>>61807342
I dont get it, why does it work now.
Before it dropped me back to /g/
>>
>>61807194
It's actually a double, and its IEEE representation is
402599999999999a
And the tostring is working as intended desu.

What you want is the IEEE representation, which you could construct yourself pretty easily from "a.cccccccccccd."

But why do you need such a thing for Javascript?
>>
>>61807342
GOD TIER PROGRAMMER ALERT
>>
>>61807086
Ayylmao moar cores fags bttffoo haha xdddd
>>
>>61807439
Well, you are right. I thought it was a 32bit float. That explains everything.

Im using firefox firebug to dump restricted data from a site putting a breakpoint inside their running scripts. Firebug has a console that allows js commands to be executed in the context where the breakpoint is triggered.
Theres no way to just save variables to a file from there, so im dumping the data in the console which is around a 100000 element long float array. I thought dumping as hex would take up less console buffer than all the digits of the floats. Even so the browser locks up pretty easily.
>>
What's your fav c++ IDE for Linux? Vim not included

I've tried,
*geany - solid and mature but dated looks and function

*codeblocks - absolutely loved the context assist, best ide in terms of editor. But sadly its written in a shitty graphics api and theming it even to a dark theme is a ridiculous mission.

*eclipse - great UI, button layout and heuristics are 10/10 but the context assist is trash unfortunately

And now I'm using Clion which is my current favourite. I'm used to the jetbeans UI from pycharm, its consistent, helpful and intuitive. Everything just werks

The downside is its non-free, at least as in freedom.
>>
>>61807691
Qt Creator
>>
>>61807592
Neat.
>>
>>61807691
>vim not included
Nano and screen.
>>
File: Screenshot_2017-08-08_20-16-01.png (1MB, 1599x899px) Image search: [Google]
Screenshot_2017-08-08_20-16-01.png
1MB, 1599x899px
Was going to add unions today, but ended up changing my grammar a bit to fix shift/reduce conflicts and fixing a few bugs that popped up.
>>
>>61807691
I don't like any of the IDEs available for linux. I need VS, I demand VS!
>>
File: 1491330333168.jpg (180KB, 1787x1281px) Image search: [Google]
1491330333168.jpg
180KB, 1787x1281px
>>61806360
So it seems like there is literally nobody on the whole green earth that does TDD and uses a proper CMake setup. Actually it appears to be impossible due to mocks not being visible to production code when the test code is compiled separately, which in any sane build, is exactly the case.
The problem is basically that you can't mock a function in test code, compile test code with -Wl,--wrap=, and then force your library to honor that wrap when it was not compiled with the same linker flags. However if you compile your production code with the same link flags as your test code, then you break your program, you are stuck in test and the mocks get called even when you are executing the main application and not the test suite.
How the fuck can a mere mortal get around this without littering everything with #ifdefs or compromising the overall project structure and modularity?
>>
>>61806788
What language is that?
>>
>>61808264
Cuck
>>
>>61806826
iktf
>>
>>61806387
Unleash the hounds.
>>
File: scheme.png (384KB, 1024x768px) Image search: [Google]
scheme.png
384KB, 1024x768px
>>61808247
Scheme
>>
how do I OOP efficiently?
>>
trying to force a click function on an element in an iframe. no luck so far. any suggestions?
>>
>>61808264
Fuck off with your stupid normie thread this is the real one.
>>
>>61808459
By not using POO
>>
>>61808459
you cant
>>
>>61806360
Rate my code
// main.c
#include <stdio.h>
#include <quadmath.h>

int main()
{
__float128 a = 1000000000000000000000.09q;
__float128 b = 1000000000000000000000.03q;

if(a == b)
printf("Equal\n");
else
printf("Not equal\n");

return 0;
}

gcc main.c -lquadmath && ./a.out
>>
File: 1495861405261.jpg (106KB, 564x560px) Image search: [Google]
1495861405261.jpg
106KB, 564x560px
Finessing a ratchet way of doing args in CL.
Basically, I'm thinking of mapping #'make-string-input-stream to *argv* (interspersed with " "), then apply #'make-concatenated-stream to the streams, and then #'read 'ing all the values into a list, which is then set as the property list of a symbol, so that I then can do proper routines if the needed symbols are there or not

My first thought was using keywords, but fuck that, too hard lmao.
>>
>>61808395
Nice
>>
>>61806788
>make_
>>
>>61808867
make- is not a valid identifier in C though anon.

C made me do make_.
>>
File: 1463363949111.jpg (36KB, 511x509px) Image search: [Google]
1463363949111.jpg
36KB, 511x509px
Employed Haskell programmer reporting in
>>
>>61809042
What have you been working on in Haskell?
>>
>>61806788
You're my new favorite
>>
Is there anyway to make this look better and more concise? I'm pretty new to Clojure.
>>
>>61809090
>implying he's being paid to write Haskell

he just said that he's a Haskell programmer and that he is employed. Flipping burgers in the day and letting the GC generate tons of garbage at night
>>
>>61809176
>he just said that he's a Haskell programmer
So what's he working on at night?
>>
>>61809042
I want fries and a large soda, please.
>>
>>61806437
Why havent you applied to mojang and asked them to hire you yet
>>
>>61809431
Minecraft clones a diamond dozen anon, why would mojang give a shit?
>>
>>61809154
That looks reasonably concise to me.
Lisp (clojure) just ends up looking like that.
You can do newline indentation if you'd like, it'll make it cleaner but it'll also make it look way way longer.
>>
>>61809154
You have a lot of repeated code. Abstract it into a function.
>>
>>61809431
I don't wanna move to seattle and work for microsoft
>>
anime
>>
File: 2017-08-08-231839_538x57_scrot.png (3KB, 538x57px) Image search: [Google]
2017-08-08-231839_538x57_scrot.png
3KB, 538x57px
Still teaching myself regression, now by collecting a 4chan-related dataset: the number of replies for every thread on a given board over time. It's running now on /a/ in its more or less final stage (pic related), writing the output to a JSON file.

I'll likely run it for most of the week and graph the output occasionally, then try to see if I can model the "best time" to post on 4chan, I.E. when the number of posts over time on the board is at its highest.

Gonna read up on logical regression soon once I'm satisfied that I can produce effective models.
>>
>>61806360
Trying to run RAID on usb thumb drives
>>
>>61799372
If I'm only comfortable reading the disasm of my program is that 'knowing' asm?
>>
>>61808149
>TDD
It's popular. It just stinks as a paradigm. So much overhead. Every test you make hardens your code and a core philosophy of TDD is that you're locking down your api early for your tests.
But you're probably just a zealot so you don't care for reason. Just deal with your issues. If you can't figure this out why bother with programming?
>>
>>61806387
It's hilarious to me that people who think trans people are delusional are more triggered about trans people existing and having jobs than trans people are that some people think they're delusional.
>>
>>61809463
>a diamond dozen
No, you're wrong, it's "a dime a dozen."
>inb4 "being this new"
No, you're wrong, it's still "a dime a dozen" no matter what erroneous and filthy unfunny memes have come out of it.
>>
>>61809864
please go back to your containment board and stop shitting up /g/
>>
File: flat,800x800,075,f.jpg (67KB, 800x402px) Image search: [Google]
flat,800x800,075,f.jpg
67KB, 800x402px
>>61806387
Moral of the story is never work with Go
>>
>>61809864
This sentence absolutely need commas.
>>
>>61810052
but what if he overloads the comma operator?
>>
>>61809998
Try directing your sentiment to the appropriate recipient: >>61806387
>>
>>61810052
>commas
branlet
no you are not even a brainlet you are a fucking branlet do you understand me
you try to eat raisin bran
but it is
TOO FUCKING SMALL
that's how small your bran is
>>
>>61806360
Is this valid scheme?
(lambda (x x) x)
(let ((x 0) (x 0)) x)

I'm writing a macro where I end up with duplicate symbols in my lets and lambdas.

It works on my machine but my repl is giving off a warning.

I can't use let* because the actual use case is:
(let ((x (foo x)) (x (foo x))) expr)
>>
>>61810052
It may surprise you to know my long sentence is actually grammatically correct as it is, and no commas are necessary--or, in fact, grammatically possible.
>>
What is a good resource to learn Java that is similar in style to Automate the Boring Stuff with Python?
>>
>>61810087
Pig related.
>>
>>61810062
struct meme { meme &operator()() { return *this; } };
int main() {
meme()()()()()()()()()()()()()()()()()()()()()()()();
}
>>
>>61810186
but overloading the () operator is useful for doing things with make_shared and make_unique

overloading the comma operator is just dumb.
>>
>>61810208
Well yeah. The comma operator should not even be a member function in any situation whatsoever.
Also: Why does C++ not have static operators?
>>
>>61810028
which is a goddamn shame, since go actually fills a niche and could use real research development.
>>
>>61810286
yeah, like research into the 70s and "what are generics?"
>>
>>61810125
>It's hilarious to me that people who think trans people are delusional are more triggered about trans people existing and having jobs than trans people are that some people think they're delusional.
It's also disgustingly poorly written. Copyedit attempt:
>By existing and holding jobs, transsexuals trigger people who think "trannies are delusional" more than those people trigger transsexuals. I think that's hilarious.
>>
File: 1500258206435.gif (1MB, 450x450px) Image search: [Google]
1500258206435.gif
1MB, 450x450px
>>61810314
>>
>>61810314
>"what are generics?"
Unnecessary is what they are. Only three use cases and all of them are bad code smells.
>1) You want to pretend your language is dynamically typed.
Just don't.
>2) You manipulate different types of data the same way at different times and want to reduce code duplication.
Again, just don't. Code duplication should only be reduced when the code doesn't mean different things or serve different purposes in the different places it appears.
>3) You're writing a library.
Gross. Don't fucking use libraries or ADTs, ew. Modularity is overrated, real programming is all about doing everything as low level as possible and squeezing every last drop of performance out of every algorithm.
>>
http://ferret-lang.org/

Hey look, a Clojure -> C++11 compiler.
>>
>>61810431

>Don't use ADTs
Datadata, is that you?
>>
Here we have a common lisp implementation...

https://github.com/drmeister/clasp

>Building on most systems will take around 8-12GB of memory and ~1-2 hours with a relatively modern processor, so be prepared to watch a movie or do some other useful work until Clasp is all done. You may also want to activate a large enough swap file if your system does not have enough DRAM.
>Currently there are no binary releases available.
>>
>>61810681
>>61810761
>>61810953
Report. Please don't spam next time.
>>
>>61811015

These are not spam posts. There are several minutes between each one.
>>
>>61811015
>t. newfag

>>61809698
for something useful, or just as a curiosity?
>>
why does he trip
>>
>>61808395
Is that racket specifically?
>>
Why is it that job ads for programming in the finance sector usually don't put higher requirements for applicants than ads in other sectors when the salaries are so high?
>>
>>61811167
fintech is a meat grinder
>>
>>61811175
What does that mean?
>>
>>61811198
massive churn rate.
go in as an intern or junior developer and chance of you staying long enough for a promotion is rather low. the demands of the fields are generally too high for most people. and the mba infestation, that is finance, is enough to drive anyone sane away.
>>
is there a text editor where it possible to select a section of text and for that section
1 remove all line breaks
2 add new line breaks so that no line exceeds 100 characters
>>
so, how useful IS lisp's macro system?
I know lispers are die-hard about it and claim it changes lives and shieet, but for any casual lispers here, how useful do you honestly find it?
>>
>>61811353
vim, and probably even ed
>>
>>61811421
what vim command?
>>
>>61811353
The jetbrains editors' search and replace supports regex, I've done fancy stuff with it b4
>>
>>61811353
In that beating the averages essay, the guy said, that 20-25% of their codebas was macros. I'd say that'a pretty substantial
>>
>>61811124
It's Chicken.

>>61811372
It's absolutely amazing.

>>61811425
:set tw={width}
>>
>>61811353
shell
< input.txt tr -d "\n" | fold -w 100 > butts.lol
>>
File: 1481387700712.jpg (19KB, 286x283px) Image search: [Google]
1481387700712.jpg
19KB, 286x283px
idea guy here

fizzbuzz blockchain
>>
>>61811600
you can be the implementation guy
>>
Trying to get my Arduino's BLE module to communicate with fucking ANYTHING at an 115200 baud rate. REEEEEEEEEEE
>>
>>61806360
what's a simple way to create a bitmask of repeating "101010101..." ?
>>
x1.print()
>>
File: 1491188514748.gif (897KB, 800x430px) Image search: [Google]
1491188514748.gif
897KB, 800x430px
>>61811600
>mfw fizzbuzz ASICs
>>
I'm teaching myself asm. Can someone help me out? How do I properly access the connects of t and put it into edx? I'm doing something wrong and I don't understand it
>>
File: stem_bait.png (177KB, 1130x855px) Image search: [Google]
stem_bait.png
177KB, 1130x855px
Look what I found on /pol/...
>>
>>61809864
>>>/r/programming
>>
File: pickle rickers.png (81KB, 554x400px) Image search: [Google]
pickle rickers.png
81KB, 554x400px
>>61806641
DAB ON THE HATERS
>>
>>61807691
emacs
>>
>>61811996

Are you using nasm syntax? Because this:
mov edx, t

moves the address of t into edx, while this:
mov dl, [t]

dereferences t and stores the byte into dl (the lowest 8 bits of edx).
>>
>>61809154
reading Lisp code takes time to get used to
>>
>>61811951
bin(0x55555555)
>>
>>61812098
I am using nasm. Thanks anon. I also didn't realize I wasn't filling the entire 32 bit reg so I switched to a quad word
>>
>>61812170

If you are using interrupt 0x80 to send system calls, I'm guessing you're using 32-bit Linux. In which case, how are you using quad words?
>>
>>61812186
64-bit virtual machine. Tutorial I'm trying to follow is for 32 bit machines but still seems to work.
>>
>>61812040
Fuck off normie.
>>
How long the data science meme will last before it's too crowded and wages starts to drop?
>>
File: Без име.png (118KB, 1366x702px) Image search: [Google]
Без име.png
118KB, 1366x702px
some C fag can please tell me why my code does not work?
I want to use scanf to produce what is on the right side but everything I try does not work
>>
>>61812004
>>>/pol/
>>>/reddit/
>>
>>61812295
>sizeof char
strlen gives you the length if you want to malloc space for it you need to + 1 for the null terminator.
>>
You want scanf("%s", &c);
>>
>>61812004
as a /pol/acks i am deeply offended by this post
delet
>>
File: cs50.jpg (13KB, 501x501px) Image search: [Google]
cs50.jpg
13KB, 501x501px
>>61806360

I just finished the problem set for week 1 in CS50.

Get that C.
>>
File: 2017-08-09_47:14.png (23KB, 544x160px) Image search: [Google]
2017-08-09_47:14.png
23KB, 544x160px
>codecademy
is this website for children? just wondering

i guess that'd be just right
>>
>>61812613

It's made for normies who are new to programming
>>
Im about to be a junior in college and i want to start learning programming and the different applivations i can use it for. I was wondering if there are any good resources to help get me started
>>
>>61812702
There are literally a billion resources. What do you want to build?
>>
File: FUCK YOU.png (44KB, 254x252px) Image search: [Google]
FUCK YOU.png
44KB, 254x252px
I can find plenty of attempts to have asymmetric encryption in pure Lua.
I can'f find any successful implementations though.
>tfw entire project halts because for some reason, no one has done assymmetric encryption in a major language
>>
>>61812709
I want to learn about cyber security.
>>
>>61812720
Off yourself animetard.
>>
>>61812732
ah sorry, I don't really know anything about that. Hopefully someone will reply. You can also google "beginning cs security resources" or something similar.
>>
File: 1453301998037.png (239KB, 600x506px) Image search: [Google]
1453301998037.png
239KB, 600x506px
>>61812742
He didn't post anime, though?
>>
>>61812720
Roll your own.
>>
>>61806360
uhh so I decided after reading that minecraft clone guy to mess with scheme and make quick roguelike and since I like having objects I went to find out how to make one... This is simplest I came across...

(require-extension srfi-99)
(define :point
(make-rtd 'point '#((mutable x) (mutable y))))

(define make-point (rtd-constructor :point))

(define point? (rtd-predicate :point))
(define point-x (rtd-accessor :point 'x))
(define point-y (rtd-accessor :point 'y))
(define point-x-set! (rtd-mutator :point 'x))
(define point-y-set! (rtd-mutator :point 'y))

(define p1 (make-point 1 2))
(print (point-x p1))

(define make-point/abs
(let ((maker (rtd-constructor :point)))
(lambda (x y)
(maker (abs x) (abs y)))))
(print(point-x (make-point/abs -1 2)))
>>
>>61812846
>
mutable x) (mutable y

absolutely awful, get a new HDD and try again
>>
>>61812720

Most people don't want to have to maintain a crypto library of their own, and as such, make a wrapper around C libraries. If you're working with Lua, you're likely using it as an embedded language. If not... what the fuck are you using Lua for, are you retarded?

>>61812732

Hrm... not so sure about resources, since I learned most of what I know about cybersecurity from my professors or, really, just best practices when writing C, but if you ever want to practice what you've learned when you learn it, you should check out the International Capture the Flag competition (iCTF). Fun shit. I never managed to exploit any vulnerabilities when I participated with my class, but did managed to patch a few up.
>>
>>61812846
this is not an object but a data type.
>>
>>61812865

Blech, forgot to add onto the first reply there that since Lua's main use is embedded, one shouldn't feel the need to do everything in pure Lua. No point in making a Lua library for stuff that C already has handled.
>>
>>61812865
There's a surprising amount of programs out there which can only run pure Lua.
>>
>>61808009
You should really drop the let syntax it's ugly.
Also is your language using whitespace for blocks? If so that's good.
>>
File: 1487413306014.png (383KB, 611x720px) Image search: [Google]
1487413306014.png
383KB, 611x720px
>What are you working on, /g/?
I just implemented atomic modesetting in my wayland compositor backend.
I would post a picture, but it doesn't look any different than before, and would just be a blank screen.
Now I need to look into supporting multiple GPUs.
>>
>>61813161
Are you gonna release it as FOSS?
>>
>>61813177
It's already on github. I'm not the only developer.
I don't know whether I want to link it here, though.
>>
>>61813205
>I don't know whether I want to link it here, though.
Why?
>>
>>61813212
Because I'm not the only developer.
>>
>>61813231
Im still not seeing the issue.
>>
>>61813245
>>61813161
Eh, fuck it:
https://github.com/SirCmpwn/wlroots
This is not my repo, but it'll be pretty obvious who I am.
>>
>>61813259
no one gives a shit scott, i just want to learn about wayland. Thanks m8
>>
Alright, I might as well make my own pure-Lua RSA library, since none exist.
Anyone know where I can find an explanation of the RSA algorithm that doesn't skip half the steps?
>>
>>61813259
>SirCmpwn
That guy is still alive?
>>
>>61813307
Yes?
>>
Embedded network stack in C
>>
>>61813325
I just know that guy because he gets banned from forums and irc channels a lot.
>>
Is there some QBasic for Linux or some better BASIC compiler?
No Python, please.
>>
>>61813353
What for? I only interact with him on the sway IRC and on github, so I haven't noticed these sorts of things.
>>
File: s.png (40KB, 1680x1050px) Image search: [Google]
s.png
40KB, 1680x1050px
>>61806360
>What are you working on, /g/?

A challenge involving a maze (pic). i think i gonna do some preprocessing where i remove all the dead-ends by doing the following:

Find a non-wall tile which is a dead-end (has only one possible move/direction)
Turn that tile into a wall
Repeat the same with the neighbor tiles until reaching a tile having more than one move

eg with
##########
#.#......#
#.#..###.#
#.##.###.#
#........#
##########


After one step
##########
###......#
#.#..###.#
#.##.###.#
#........#
##########


After two step

##########
###......#
###..###.#
#.##.###.#
#........#
##########


[...] After 6 steps we finally reach a tile with more than one direction possible so we stop here.
##########
###......#
###..###.#
####.###.#
####.....#
##########


The dead-end has now been removed. Doing this could reduce the complexity of the maze by a lot.
That idea came to me while sleeping.
>>
File: 1453303646470.jpg (73KB, 729x551px) Image search: [Google]
1453303646470.jpg
73KB, 729x551px
>>61813381
>A challenge involving a maze (pic).
What are you trying to do with the maze?

>That idea came to me while sleeping.
How often does that happen to other people?
There have been several times where I have been working on something intensively before I go to bed, and then I wake up like an hour earlier than normal with some idea of how to solve whatever I've been working on.
>>
>>61813289
Most copmsci books about discrete mahts has a chapete about rsa
>>
>>61813466
>What are you trying to do with the maze?
it's the traveling salesman problem put into a maze

"""
Given your actual map, and starting from location 0, what is the fewest number of steps required to visit every non-0 number marked on the map at least once?
"""


>>61813466
>How often does that happen to other people?
https://www.youtube.com/watch?v=DBXZWB_dNsw
>>
>>61813381
And after that you will use A* like everybody else? Whats the point? You will waste more processor time on this preprocessing than you will gain.
>>
File: 3pnkbuj.jpg (32KB, 720x405px) Image search: [Google]
3pnkbuj.jpg
32KB, 720x405px
>>61813537
i have to resolve the maze P(n, 2) times

>>61813537
>you will use A* like everybody else
i will probably go with the classic BFS
>>
>>61813611
You can resolve it once and then store the result.
>>
File: 1458021070656.png (2MB, 6925x8708px) Image search: [Google]
1458021070656.png
2MB, 6925x8708px
>>61813652
Are you sure about that?

Removing all the dead-ends is O(N * something small) since most of the tiles are walls or aren't dead-ends. First and last rows/columns are ignored. It will reduce the solver complexity by P(n,2) * amount of removed tiles. Anyway i will test with and without doing the preprocessing but first i have an episode of Boruto to watch.
>>
>>61810125
It's a terrible read is my point. Fucking idiot.
>>
>>61813718
No, I mean, you only need to solve the maze once, and if you use A* like a white man, preprocessing the maze can only increase the complexity of the whole task.
>>
>>61813765
>and if you use A* like a white man, preprocessing the maze can only increase the complexity of the whole task.

this is wrong, A* can't avoid all dead-ends. with something like this

################
#..............#
#.############.#
#.#..........#.#
#.#########.##.#
#.....0......#.#
#.############.#
#............#1#
################


a* would visit all the dead-ends before reaching 1. preprocessing the graph is a well know optimization technique for this kind of problems.
>>
>>61813381
it literally doesn't matter in your case
>>
>>61813718
You haven't said enough about the task to have him make an educated guess even.

If we have random starting locations I'd say you should search your way to the solution you already have. For mazes like these this should be trivial. If you have much more complex mazes (multiple dimensions) I'm not sure what comes out ahead. Blocking off the paths might be the best solution there.
If you want to be more clever you can construct paths leading to the first solution path you've made and append them. Using the starting point of each of the paths as alternate goals. (prioritize the goal that has the least steps to the final goal while measuring the distance to them).
The only situation where I can see you wanting to actually block dead ends like this would be if you have a maze that changes shape slightly every iteration. You cant guarantee that any old path is solid then. But I also find it weird that you'd feasibly have the option to block paths like this in that case.
>>
How do I make an API for writing plug-ins in C/C++?

I figured out I just need to load the plug-ins as dynamic libraries. So how do I search for dynamic libraries in a specific directory (and its subdirs)? And how do I protect from errors in a plug-in crashing the whole thing?
>>
File: 1501161617280.jpg (37KB, 686x576px) Image search: [Google]
1501161617280.jpg
37KB, 686x576px
Is there a more syntactically pleasing way to do this?

std::map<string, unsigned int> AnimatedModel::getChannelMap(aiAnimation* anim)
{
std::map<string, unsigned int> channelMap;

for (unsigned int i = 0; i < anim->mNumChannels; i++)
{
aiNodeAnim* channel = anim->mChannels[i];
channelMap.insert(std::pair<string, unsigned int> (channel->mNodeName.C_Str(), i));
}

return channelMap;
}


Also, will returning this map copy it? It might have up to two hundred members in it, so I would like to avoid copying. Is there a better way to return it other than making it a pointer and using new and delete?
>>
>>61814251
>Is there a more syntactically pleasing way to do this?
just change the language to literally anything else
>>
>>61814251
You can probably skip std::pair and just do:
channelMap.emplace(channel->mModeName.c_str(), i);


Also probably won't copy due to RVO/copy elision.
>>
>>61814281
Thanks!
>>
>>61814251
Isn't channelMap will be deallocated on return from the procedure?
>>
>>61814199
>C++ plugins
Don't even try. You're just asking for ABI breakages. Even if you were to use C++ (which I would never recommend), it would still be a much better idea to use a C API.
>So how do I search for dynamic libraries in a specific directory (and its subdirs)?
dlsym can open shared objects in arbitrary directories, so just get people to put them in some well-known place. e.g. "/usr/lib/myprog/plugins/whatever.so". Normal directory accessing functions can be used to get a list of them (dirent.h).
I don't know what the winmemers use for this.
>And how do I protect from errors in a plug-in crashing the whole thing?
There are a few solutions:
- Run the plugins in a separate process
- Only allow plugins in some scripting language (e.g. Lua)
Otherwise just accept that buggy plugins could crash the program.
>>
>>61814065
And pre-processing it followed by A* will take more resources that just using A*.
>>
>>61814338
I don't know C++ very well. I just thought namespaces could be helpful for the security or something.

>/usr/lib/myprog/plugins/whatever.so
I'd like something more like ~/.myprog/plugins/plugin_name/foo/whatever.so
foo being preferably a directory pointed to by some kind of config file found in plugin's main directory (~/.myprog/plugins/plugin_name/).

>- Run the plugins in a separate process
Nope.
- Only allow plugins in some scripting language (e.g. Lua)
Nope.
>Otherwise just accept that buggy plugins could crash the program.
I would rather not. :/
>>
>>61814474
>I just thought namespaces could be helpful for the security or something
Those make absolutely no difference.
>I'd like something more like ~/.myprog/plugins/plugin_name/foo/whatever.so
>foo being preferably a directory pointed to by some kind of config file found in plugin's main directory (~/.myprog/plugins/plugin_name/).
You can put it wherever you want. That's all typical directory stuff.
>Nope.
>Nope.
>I would rather not. :/
You're going to need to pick one. There aren't any other options.
>>
>>61814550
I looked at dlsym's manpage and couldn't find anything about searching for all files in an arbitrary directory. It's all about loading arbitrary files.

>You're going to need to pick one. There aren't any other options.
I think I misinterpreted "Run the plugins in a separate process" as "give each plugin a separate process" and I was scared of forking too much and wasting CPU time to switch between processes.
I'm still not convinced if this is always a good idea. Can I at least like run certain functions on the main process without needing to switch context and still keep it safe?
>>
>>61814626
If you load a dynamic library from someone into a process, that process is no longer safe. Period.
>>
>>61814626
>searching for all files in an arbitrary directory
Of course. dlopen is only going to a open single shared object. You need to walk all of the files in the directory and load them individually. The functions found in dirent.h are typically used to do that.
>I think I misinterpreted "Run the plugins in a separate process" as "give each plugin a separate process"
Either works.
>I was scared of forking too much and wasting CPU time to switch between processes
That's not really much to be worried about. There are going to be context switches regardless, and modern computers have many cores/threads.

This anon (>>61814664) is right. Loading a plugin inherently makes it unsafe. You're giving the plugin the ability to run arbitrary code with the same permissions as your process.
That's why several programs use Lua, but gut it of a lot of the standard library functions and the ability to load external modules, creating a little sandbox.
There are ways to sandbox "native" code, but it's a shitload more complicated.
>>
>>61809431
why would they hire someone who thought it would be a good idea to write a minecraft clone in lisp
>>
Finally got my C toolchain self-hosting. I'm pretty pleased, it's been a long time coming.
>>
>>61814722
>There are ways to sandbox "native" code, but it's a shitload more complicated.
Tell me more of these.
Also, how performant are these compared to running a separate process, depending on how much the plug-ins need to cooperate with the main process and shit.

A separate process can still fuck you up, just it has less ways to do so. You can still easily access parent's PID and send a SIGKILL to it for example.
>>
>>61814841
>Tell me more of these.
Linux has cgroups, which can be used for sandboxing, but I don't really know a lot of the details.
That's how https://en.wikipedia.org/wiki/Flatpak works.
>>
>>61814841
>you can send a signal
Run the process from another user.
>>
>>61814901
I'm pretty sure the sandboxed code runs in another process here.
>>
>>61812004
>the real problem with IT?
>IT
>>
>>61815064
It actually requires root privileges to run a process as somebody else.
>>
>>61815082
It goes a lot further than that. It creates its own separate filesystem and severely limits access to other system resources (e.g. the network; they have to be explicitly enabled), meaning that programs can't fuck with your shit, even if they're run as your user.
>>
>>61815110
Eh, no, I'm pretty sure suid flag for a binary file makes it possible to run that file as another user, with none of those two being root.
>>
>>61815163
Yeah, well, the person you're talking to doesn't even want another process.
>>
>>61814251
What are you doing, anon?
Use a Vector.
>>
>>61815407
I already have a vector of channels. I need a map of channel names to channels because the channels are referred to by name in a different data structure I'm trying to parse.
>>
>>61815462
what are you doing? a game?
>>
>>61815462
It's just weird that you have a map to indexes
>>
Good books/tutorials/guides on matrix math for graphics? I know how to do the basics (identity, orthogonal, projection, frustum, multiplication, translation, rotation (one axis per matrix only though), scaling), but as my engine grows I will need faster and more complex ones (like rotating all three axes and other stuff I don't know about).

For know I'm using linmath.h as reference, but I want to feel more confident about what I'm doing.

https://github.com/datenwolf/linmath.h/blob/master/linmath.h
>>
>>61815516
I am importing animated 3D assets from Assimp for a game engine, yes.

>>61815567
Map to indices of a vector is a thing I do a lot in my code, because most of the things I have need to be tightly packed in memory so I can send it to the GPU, and map lookups are typically faster than iterating a list looking for a name, and names are usually useless data for the GPU so I don't want to include them in my objects.
>>
>>61815686
Anyway, since for now I'm making a 2D game, I'll be fine with a fistfull (5) of matrix functions:

>identity
>scaling
>translation
>rotating (3 private functions multiplied, inefficient as fuck but no need for optimization for now)
>multiplication

I won't need to do any orthogonal matrix since orthogonal matrix is just dividing by aspect ratio which is a scaling operation.
>>
Does anyone remember the name of that random number formula for evenly spaced random numbers? Basically what you do is take a random point, then select a bunch of other random points, and choose which one is furthest away from the first one, then repeat the process.
>>
>>61815947
this?

https://mollyrocket.com/casey/stream_0015.html
>>
This is easily the best part of 8.2.1
>>
>>61816104
>8.2.1
>since 4.10
??
>>
>>61816104
>->
>:~~:
Absolutely disginsting syntax
>>
Why can't I have nested functions in C?
>>
>>61816125
4.10 is the version of Base, the default library
8.2.1 is the corresponding Haskell version, including the type checker and typeable magic that makes this possible (and including the library, obviously)

>>61816141
->
Is not remotely disgusting.
Yes, unicode would be better, but -> is perfectly acceptable.
(You can enable UnicodeSyntax if you don't like it.)

:~~: is a type operator.
It could have also been called
HEq a b
>>
>>61816163
You can with gcc extension, clang might also support it.
>>
>>61809154
yes, stop using s-expr based languages.
>>
>>61816168
>Is not remotely disgusting.
>needing 2 characters for one of the most used symbol in language
Haskell sucks.
>>
>>61816188
I know, but why is it not standard? Also I'm stuck using C++ and g++ doesn't support it.
>>
>>61816198
Not my fault you don't have → on your keyboard
>>
>>61816208
C++ lets you nest functions using lambda syntax.
statid void f(int x)
{
auto y = []() {
return 1;
};

std::printf("%d\n", x + y());
}
>>
>>61816208
Sepples has lambdas.
C might get lambdas with the upcoming standard.
Currently clang's C support lambdas and you need to use the Apples patches for GCC to get lambdas in C.

>>61816217
dumb haskell poster
>>
>>61816235
Why clutter C with lambdas?
>>
>>61816224
>printf
Learn to write sepples or go home
>>
>>61816198
[]<>(,)->void{;}();
>>
>>61808459
I tried to learn it and asked people here as well... Nobody here knows how to do it in a reasonable way and nobody here know any resources to learn it.
>>
>>61816224
>>61816235
A lambda would work decently for my purposes, thanks. Still feels ugly.
>>
>>61816249
I/O streams are disgrace and no sane C++ developer should subject themselves to using them.

Custom sprintf based printing based on function overloads (for custom type formatting) and variadic arguments is the only good way to go.
>>
>>61816246
>Why clutter C with lambdas?
Because lambdas are useful and you don't want to clutter the namespace.

>>61816259
Never said sepples was good either, faggot haskell poster
>>
>>61816271
What language do you consider good?
>>
>>61816267
>Custom sprintf based printing based on function overloads (for custom type formatting) and variadic arguments is the only good way to go.
Tell me more about this.
>>
>>61816281
Lisp, if you want C style chapel seems to be the only decent one.
>>
>>61816294
>Lispfag complaining about verbose syntax
>>
>>61806788
very nice
>>
>>61816306
>verbose
I said ugly, dumb haskell poster.
Also nothing stops you from writing some reader macro such that you could write your disgusting haskell in lisp.
>>
>>61816271
>lambdas are useful
so is type inference, switch ranges, function overloading with standard mangling scheme, references and many other things.
>you don't want to clutter the namespace
static
>>
>>61816337
>function overloading with standard mangling scheme
surely you're not referring to sepples?
>>
>>61816332
>(((n- nothing) stops) (you from) ((writing (a (reader (macro))))))
get out of here
>>
>>61816337
>type inference
Would love that C compilers supported that.
>function overloading, tandard mangling scheme
gay
>references
We already have pointers for that
>many other things
Fuck off with your templates, sepplesfag
>>
>>61816362
type inference does not belong in C
auto c = 'x'; // -> int
>>
File: what.png (24KB, 541x669px) Image search: [Google]
what.png
24KB, 541x669px
So I was doing some basic exercises in java and while trying to make °C/°F converter I got this result
Why the fuck I got 26.999...6 from
>(80.6 - 32) / 1.8
Wolfram and other calculators are giving me 70, are they wrong or is something wrong with java?
>>
>>61816362
>gay
have fun writing generic macros
>we already have pointers for that
let's get rid of arrays then if you don't like syntactic sugar
>>61816383
Completely predictable. Any C programmer knows this.
>>
>>61816288
Essentially your starting point is a function that has a signature of printf/sprintf/snprintf except instead of directly formatting the string you turn that into a variadic template tuple which you then traverse and call overloaded cast function on each argument (and just return T for T where T is a primitive as used by default snprintf). After expansion and conversion you just call snprintf back with the converted arguments. Which in the end will let you create cast overloads for custom types, like so:
struct Point
{
const char *c_str() const {
// ...
}
};

inline const char *format_cast(const std::string &s)
{
return s.c_str();
}

inline const char *format_cast(const Point &point)
{
return point.c_str();
}


Which will make your custom types work fine once you invoke your initial function with %s format specifier.
>>
>>61816389
Java's giving you the right answer.
>>
>>61816383
something like
int fn();
double fn2();
#include <stdio.h>
int main(void)
{
let x = fn(),
y:double = fn2(); // optional type specifier for cases where compiler can't figure it out
printf("%d, %f\n", x, y);
return 0;
}
>>
>>61816383
Cniles will defend this.
>>
>>61816421
Nothing to defend. It's clearly defined by the standard.

Also, putchar and getchar should ring a bell.
>>
>>61816447
>It's clearly defined by the standard.
everything in sepples is clearly defined by the standard, doesn't mean it isn't an incomprehensible clusterfuck
C is supposed to be simple and obvious, any structures that lead to unintuitive behaviour should not be present
>>
>>61816469
Always reminds me of this: http://www.c-faq.com/index.html
>>
>>61816469
How is
auto c = 'x'; // <- int
unintuitive when putchar prototype is
putchar(int c);
?
>>
>>61816447
>Also, putchar and getchar should ring a bell.
putchar and getchar return an actual integer, because, you know, error codes and EOF being outside ASCII range. That's easy to defend, seeing how you can truncate a char into an int. What's not, however, is C auto-inferring all unknown types to integers.

Forgot to declare a function before calling it? No problem, we'll assume it returns an integer.

Using _Generic with a character literal as argument? No problem, C will infer it as an int.

Using a literal as a right-hand shift operator? No problem, C will assume the result is an int and overflow is undefined.
>>
>>61816224
i don't like it, why wouldn't they allow the normal function syntax (but nested inside the function, because it's a utility function that is only relevant for the parent function)

and what's the deal with constexpr constructors, you have to do the weird thing like

constexpr FizzBuzz(const Foo &f, const Bar &b) : foo(f), bar(b) {}


instead of doing things in the body of the constructor
>>
>>61816484
See >>61816498

getchar returns an integer, because it can return EOF.
>>
>>61816515
But what if sizeof(char) == sizeof(int)?
>>
>>61816502
You should be doing that anyway. Initialization is not assignment.
>>
>>61816524
It's guaranteed not to be.
>>
>>61816524
That will most likely never ever happen.

sizeof(char) must always be 1, as char is the smallest addressable unit the system supports. An integer must be able at least 16 bits. So unless you have a weird architecture where 16-bits make a byte, I don't see how that will happen.
>>
>>61816539
>implying
>>
>>61816546
See >>61816545

And in the case where you have 16-bits bytes, the most likely outcome is that the implementation will up ints to at least two bytes (aka a word).
>>
>>61816527
in the constructor body you could do more complex things and assign values to temp variables, why wouldn't you allow that, instead you have to do everything inline after the colon and before the curly brace
>>
>>61816502
>and what's the deal with constexpr constructors, you have to do the weird thing like
That's not weird, that's one of the two preffered ways to initialize variables in the constructor if no branching based logic is required. The other default being:
struct FizzBuzz {
int x = 0; // any fizzbuzz instance will have this initialized to 0 by default
FizzBuzz() {}
};


And the reason that you have to do it this way is because the standard explicitly states which operations are allowed in the body of a constexpr constructor (https://github.com/cplusplus/draft/blob/b7b8ed08ba4c111ad03e13e8524a1b746cb74ec6/papers/N3936.pdf), section 7.1.5).
>>
File: 2017-08-08-202628_1366x768_scrot.png (139KB, 1366x768px) Image search: [Google]
2017-08-08-202628_1366x768_scrot.png
139KB, 1366x768px
>>61816539
>Guaranteed not to be.
Completely false.
>>
>>61816557
>most likely
But not every time
>>
>>61816563
>And the reason that you have to do it this way is because the standard explicitly states which operations are allowed in the body of a constexpr constructor
this is pointless if you can just circumvent it with the colon thing
>>
>>61816567
See >>61816557

There is no conceivable way the assumption that sizeof(char) == sizeof(int) will hold true. Especially since the standard is very clear that ints _should_ be larger than chars and at least be able to represent 65535 different values.
>>
>>61816581
It is not because the "weird colon thing" invokes a different method than assignment.
>>
I feel like a pleb for using LISP (Garbage Collected)
>>
>>61806360
Cute girl :3

>>61806788
Do you have a github or something at least?
>>
Statically typed and manually memory managed Common Lisp derivation when?
>>
>>61816695
>functional programming without a GC
>>
>>61807343
pajeet
>>
>>61816704
>implying Common Lisp is "functional language"
>>
>>61813159
>You should really drop the let syntax it's ugly.
Maybe
>whitespace
It's also delimited by a semicolon, which I may or may not drop if it's easy enough to do so
>>
>>61816727
>drop let syntax
How would you distinguish variable declaration from simple assignment to avoid mistyping bugs?
>>
Learning TkInter making my first GUI for a spreadsheet software
>>
Hi guys! What do you think?

https://pastebin.com/3NQ1KVe6
>>
>>61816891
>https://pastebin.com/3NQ1KVe6
>no simd
>no restrict pointers
>usingUglyAssCamelCaseSyntaxLikeSomekindOfRetardedJavaFaggot
>>
>>61816906
>no simd
Premature optimization is the root of all evil.
>no restrict pointers
There is one int dgMatMul, but not for perfomance. It's for documentation - product must be a different matrix.
>usingUglyAssCamelCase
Shorter, thus superior. Consider
using_ugly_ass_camel_case
Much longer, clutters code.
>>
>>61816906
>>usingUglyAssCamelCaseSyntaxLikeSomekindOfRetardedJavaFaggot
camelCase functions and snake_case variables is the patrician style
>>
>>61816970
functions *ARE* variables, anon. They're just pointers to execute-only data, if I remember my ELF format correctly.
>>
>>61816947
>Premature optimization is the root of all evil.
kys, performance is one of the main concerns of a matrix library, dgMatMultiply looks like shit anyway
>>
>>61816985
this
real C++ programmers should define functions as following

myfunction = [](arguments) -> returntype { body };
>>
>>61816985
> They're just pointers to execute-only data
So they're constant. Not variables.
>>
>>61816970
>drawing distinction between procedures and data
>camel case and not kebab
>>
>>61817012
>using languages with mutable data
o shit wat r u doin
>>
>>61817029
You're writing C, not Lisp.
>>
>>61817002
This is not a matrix library, this is a simple game engine. When it will begin stuttering my HP Compaq, I will, to begin with, *inline* them, and only then use restrict pointers. For now my crappy laptop handles this just fine.

>>61817012
There are machines without paging, and there changing them is ok, so they're not necessarily immutable.

Also, since const char *x = "x" is not a variable, what is it, since it's not a constant expression or a function?
>>
https://www.churchwood.at/posts/a-farewell-to-go/

>The Go compiler is repressively enforcing a mix of Google’s C++ and Python style guidelines. For example placing an opening curly bracket on a new line causes the compiler to emit a syntax error.

What the fuck
>>
>>61816970
>not using dash-case
lmao
>>
>>61817083
Welcome to the future. Now program in the only way we approve or you program won't compile and the compiler will send message to google that this guy should be added to blacklist.
>>
>>61817069
Why are you writing your own matrix library for a game?

Just use linmath.h nigga
>>
>>61817083
>he same goes for string concetanations that start on a new line.
horrifying
>>
>>61817083
it's a language meant for google internal use really, why do shitters have to adopt every single meme language and then whine about them
>>
File: wisesnek.jpg (190KB, 621x1000px) Image search: [Google]
wisesnek.jpg
190KB, 621x1000px
Iam about to cry Ido not understand anything
 1 CXX = g++
2 CFLAGS = -Wall -c $(DEBUG)
3 LFLAGS = -Wall $(DEBUG)
4 OBJS = main.o mainloop.o common/loadShader.o
5
6 looloo: $(OBJS)
7 $(CXX) $(LFLAGS) $(OBJS) -o looloo
8
9 main.o: main.cpp mainloop.h
10 $(CXX) $(CFLAGS) main.cpp
11
12 mainloop.o: mainloop.cpp common/loadShader.h
13 $(CXX) $(CFLAGS) mainloop.cpp
14



make
g++ -Wall -c mainloop.cpp
In file included from mainloop.cpp:7:0:
common/loadShader.cpp: In function ‘GLuint LoadShaders(const char*, const char*)’:
common/loadShader.cpp:18:36: error: variable ‘std::ifstream VertexShaderStream’ has initializer but incomplete type
std::ifstream VertexShaderStream(vertex_file_path, std::ios::in);
^~~~~~~~~~~~~~~~



  1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <GL/glew.h>
4 #include <glm/glm.hpp>
5 #include <GLFW/glfw3.h>
6 #include <string>
7
8
9 using std::ios;
10 GLuint LoadShaders(const char * vertex_file_path,const char * fragment_file_path){
....
>>
>>61817128
I'm actually referring to it. It has lots of stuff I don't need right now, and I want to keep it very minimal. I will expand it as the time goes by, but for now I don't need it (nor do I need textures).

>>61817083
Nice. I have a language idea that could be implemented this way to further condense the language without losing readability, like python did with indentation:

>CONSTANT_FOO
>variableFooOrFunction
>TypeName
>DontKnowYetMaybeReservedOrSomething
>vErYfUcKiNgPrIvAtEsHiT
>>
>>61817182
Then don't use C++ before you fully grasp C, you fucking retard.

Now tell me what
void foo(int array[static 1]) {}
is
>>
>>61817219
do your own homework.
>>
>>61817194
I've only once met a language where naming scheme affects the type of identifier it is.
>>
>>61817231
It's a function that takes an array of at least one integer. And you didn't know that.
>>
>>61817219
garbage style because it uses array notation in parameters

>>61817246
It takes a pointer. You cannot pass an array to a function in C.
>>
>>61817219
Ido not want to use C++ but the boilerplate trash is written in it so I am trying to hide it away somewhere so I can return to just using C without any tricky difficult details
>>
>>61817240
Shit, I thought I was original. What was it? Why didn't it catch on?

>>61817251
This is *not* equivalent to
void foo(int *array);
, you brainlet
>>
>>61817280
>What was it?
fortran without "Implicit none" used to make variables that started with the characters I-M or something integers and anything else was reals afair
>>
>>61817280
https://stackoverflow.com/questions/3430315/what-is-the-purpose-of-static-keyword-in-array-parameter-of-function-like-char
>>
>>61817280
I never said that it was. It's still a pointer,
[static 1]
just makes assertions about the data it points to.
>>
>>61817246
the compiler isn't required to check it so it's essentially meaningless
>>
>>61817310
So it's not a *style*, because style is a matter of preference. This is a language feature that can only be achieved this way.

It's like saying that using restrict is style.

>>61817337
The compiler isn't required to check restrict or inline either, but they're both there for a reason.
>>
>>61816779
It's FP, there's only declarations
>>
>>61817348
Actually, inline functions face additional restrictions, but anyway the compiler does not *have* to actually inline them, so you can say that restrict and inline are essentially a meaningless keywords, by your logic.
>>
>>61817348
It's a language feature that can only be achieved with a misleading declaration style. Clarity is more important than an annotation which, as far as I'm aware, doesn't change anything in the object code.
>>
>>61817301
This makes C look like a modern language. Almost scary desu.
>>
>>61817378
It's a concise way of documenting that function does not check for NULL pointer, or needs a buffer of at least N bytes, without needing to write a verbose, lengthy, redundant comment.

The same way you can use restrict to document that pointers cannot point to the same object.
>>
>>61817370
inline IS a meaningless keyword, it doesn't help the compiler
>>
>>61817410
No. A function marked inline can be defined in more than one translation unit without violating the One Definition Rule.
>>
>>61817407
>without needing to write a verbose, lengthy, redundant comment.
So don't write a verbose, lengthy comment. Write a concise one which expresses the same instead of lying in your declaration.
>>
>>61817446
you wrote
>but anyway the compiler does not *have* to actually inline them
for optimization it is meaningless
>>
>>61817182
You're missing an include.
>>
>>61817452
>lying in your declaration.
You don't lie. Instead of writing
/* foo is an array of 7 or more elements, and it doesn't check for NULL */

you write
void bar(int foo[static 7]);

which is much clearer.

>>61817460
My bad. Yes, for optimization it's meaningless, but the keyword in general is not meaningless.
>>
File: consider.jpg (29KB, 600x600px) Image search: [Google]
consider.jpg
29KB, 600x600px
new thread
>>61817506
>>
>>61817502
But foo isn't an array. It's a pointer. Declaring a parameter using the notation of an array declares a pointer instead - this is a misfeature that should be avoided. It simply isn't worth polluting your code with incorrect statements.
>>
>>61817513
thank you
>>
>>61806360
// lang C

while ( (ch = getchar()) != 'a' || ch != 'b' || ch != 'c' || ch != 'd));


Is there an equivalent of 'in' in python or is this as clean as it's getting?
>>
>>61818675
If it's a range of characters in series, compare with > and <.
>>
>>61818734

Unfortunately not.
Thread posts: 331
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.