Quantcast
[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr / vt ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Due to resource constraints, /g/ and /tg/ will no longer be archived or available. Other archivers continue to archive these boards.Become a Patron!

/g/ - Technology


View post   

[ Toggle deleted replies ]
File: 63 KB, 850x400, quote-ask-bill-gates-why-the-string-in-function-9-is-terminated-by-a-dollar-sign-ask-him-because-gary-kildall-80-18-50.jpg [View same] [iqdb] [saucenao] [google] [report]
64382988 No.64382988 [Reply] [Original] [archived.moe] [rbt]

What are you working on, /g/?

Previous thread: >>64371800

>> No.64383003
File: 54 KB, 390x503, LynnSciamA2.jpg [View same] [iqdb] [saucenao] [google] [report]
64383003

First for women in tech.

>> No.64383034

>>64382988
Changing examples to use the new API. I will hopefully start working on the benchmarks over the weekend.

https://github.com/enfiskutensykkel/ssd-gpu-dma/tree/api-rewrite

>> No.64383112

c++ is the greatest language of all time

>> No.64383116

>>64382988
what did he mean by this?

>> No.64383151

I got a problem with a simple request :
select fields
from table_A
left join table_B on a.smth = b.smth

is executed in less than a second
while
select field
from table_B
left join table_A on a.smth = b.smth

takes forever.

Why is it happening ?

>> No.64383165

>>64383151
One table has an index or key on smth, the other does not.

>> No.64383181

>>64383165
Both tables have an index on it

>> No.64383257

>>64383181
Then one of the indexes involve more fields? It's been a long (looong) time since I optimized queries.

>> No.64383267

>>64383257
>>64383181
Or, alternatively, one table has a lot more records than the other.

>> No.64383302

I am learning Racket at the moment, and I am having a lot of fun. I do have a question though. Do functional languages have a professional market? As in, can you get hired to program on a functional language. Can you guys give me examples of things that were created through functional languages?

>> No.64383331

how do i get more stupid stars for my awsome github repo

>> No.64383337

>>64383331
Post it here.

>> No.64383359

>>64383267
I don't think it would be the problem. One have 90k liens of data the other one 200k only.

I'll try a few things. related to >>64383257
but damn it's annoying.

>> No.64383378

>>64383359
Well, good luck anyway. When you find out why, feel free to post it here (or next /dpt/), I'm interested in what you find out :)

>> No.64383419

the class is more real than the instance

>> No.64383428
File: 20 KB, 576x121, Udklip.png [View same] [iqdb] [saucenao] [google] [report]
64383428

So I have a simple question.

If I want someone to write some text into a .txt file, is there a way they can make line breaks in the file?

I don't want to make a variable for every line (line1, line2, line3) and then use .writelines()

I would just like to make line breaks using one input variable.

>pic is the basic code I want to use.

>> No.64383503
File: 2.15 MB, 320x180, 1516056549705.gif [View same] [iqdb] [saucenao] [google] [report]
64383503

>This branch is 4 commits ahead of XXX:master
how to 'downgrade' to upstream?

>> No.64383514

>>64383112
damn right

>> No.64383617

>>64383503
git checkout <commit_hash>
if those commits need be discarded, perform a git reset.

>> No.64383632

>>64383428
I'm fairly sure the character '\n' will work as intended here.

>> No.64383654

>>64383503
or if you simply want to go back to the master branch, do 'git checkout master'

>> No.64383662

>>64383378
>>64383151
Holy shit. Found the issue : encoding.
Both table didn't had the same encoding and one was fucking with the other one. Both queries run as fast now.

Thx anyway man.

>> No.64383687

>>64383428
\n

>> No.64383702
File: 44 KB, 643x326, Perl.gif [View same] [iqdb] [saucenao] [google] [report]
64383702

So... why did it die?

>> No.64383712

>>64383662
I wouldn't have thought of that
good to know, thanks

>> No.64383714

>>64383302
https://hackmd.io/s/ByA-x21Hf

>> No.64383761

>>64383702
it tried to be everything

>> No.64383784

>>64383714
That is pretty cool. From that group of languages. Which one do you recommend me to learn?(After I learn scheme, of course)

>> No.64383794

>>64383784
depends what your goals are.

>> No.64383821

>>64383794
Well, my long term goals is to work on AI(including machine learning, deep learning, etc). Other than that, I wouldn't know. I would still like to learn a multi-use functional language, just to add more tools to my tool kit.

>> No.64383927
File: 2 KB, 223x226, 1496840093740.png [View same] [iqdb] [saucenao] [google] [report]
64383927

I have a dream.

A dream that I one day will create my own computing stack.
My own ISA (probably shitty RISC-V clone), my own CPU design (probably not even pipelined), my own compiler (probably only the backend for LLVM), my own kernel, my own OS.

None of them would actually be any good or worthwhile or used by anyone than me, but they would be mine and I would know them from top to bottom.

I know that this dream will probably never come to fruition, but it's a dream, damn it! (but it would be that much more realistic if one of you nerds built an actually fast circuit simulator, because FPGAs/Verilators feel too synthetic)

Anon, share a similarly ambitious dream if you have one.

>> No.64383948

>>64383927
Catgirl gf

>> No.64384009

>>64383702
What? I use it everyday at work.

>> No.64384010

>>64383632
>>64383687
Okay, so... I know about \n.

The point is I have a database with info on a lot of animals (hunting license related), and whenever I want to add a new animal, I just open the program and and enter the new data.
Problem is, I want it to look like this:

Hunting season: 1/10 - 31/1

Species: (whatever)

Age of maturity: (whatever)

And so on. The problems seems to be whenever I use \n in the input to variable Fill, it just gets printed as a string, and doesn't make a line break.

Does that clarify?

>> No.64384019

>>64384009
>What? I use it everyday at work.
for simple scripts?

what's your job?

>> No.64384020

I've developed a blogging platform where anybody can post whatever bullshit info they want.

I've recently created an 'advertising' banner spot where I can get people to advertise with me and hopefully start making dosh off of my site. All of this was coded with PHP and SQL. The database stores my adverts and the locations, the PHP pulls the files to be rendered a single random ad out of the pool of ads.

Oh and I designed it so it does not get blocked by adblock plus.
shuffle($adoutput);

$r = 0;
while($r < 1){
$sqlqueriedads = "SELECT * FROM ADVERTISEMENT WHERE ID='$adoutput[$r]'";
$resultqueriedads = $conn->query($sqlqueriedads);
if ($resultqueriedads->num_rows > 0) {
// output data of each row
$rowqueriedads = $resultqueriedads->fetch_assoc();
$adid2=$rowqueriedads['ID'];
$adurlimage2=$rowqueriedads['URLIMAGE'];
$addateadded2=$rowqueriedads['DATEADDED'];
$adurllink2=$rowqueriedads['URLLINK'];
$adtags2=$rowqueriedads['TAGS'];
$adtagjustthestring2 = $rowqueriedads['TAGS'];
$adarticletype2=$rowqueriedads['ARTICLETYPE'];
$adcodeoutput.='<a href="'.$adurllink2.'" target="_blank"><img src="'.$adurlimage2.'" alt='.$adtagjustthestring2.'></a>';
}
$r++;
}

>> No.64384063

>>64384020
>I've developed a blogging platform where anybody can post whatever bullshit info they want.
>I've recently created an 'advertising' banner spot where I can get people to advertise with me and hopefully start making dosh off of my site

so 4chan?
>Oh and I designed it so it does not get blocked by adblock plus
but gets blocked by ublock origin

>> No.64384083

>>64384019
Backend dev. We use Mojolicious mostly.

>> No.64384159

>>64383927
Are you me?

>> No.64384203
File: 24 KB, 1335x189, slow-particles.png [View same] [iqdb] [saucenao] [google] [report]
64384203

I need a rough estimation
Should I use a physics engine for the particles? or should quadtrees speed up the collision calcs a bit faster?

here's the particles in action
http://soulecule.com

>> No.64384257

>>64384159
Well, now that there's officially public interest, we need to team up and follow the standard /dpt/ development protocol:
1) Pick the name,
2) Design the logo,
3) ??? (Here be dragons),
4) Fame and glory.

>> No.64384300

sumarray(long[] array) {
long[] sumarray;
sumarray = new long[array.length];
.
.
.
}

long sum(int l, int r) {

}
}


how do I access the array I created in summarray in my sum method?

>> No.64384329

>>64384300
>make it global
>pass as parameter
>return array from sumarray and use this value

>> No.64384342
File: 212 KB, 1406x586, ubitch.jpg [View same] [iqdb] [saucenao] [google] [report]
64384342

>>64384063
Hmmm no. 4chan has moderators and don't allow certain content. If someone wanted to advertise/peddle or just talk about what they want they can. There are minimal rules and also does not store IP addresses.

>ublock origin
See pic related. it did not block my ad.

>> No.64384358

>>64384342
>See pic related. it did not block my ad.
because it's not an ad.

that's probably a simple image

>> No.64384399

>>64384358
aha its not. It's definitely an ad.

1stamender.com/article.php?articlenumber=352

With that being said... What these adblockers do is they check non-serverside coding for anything referencing 'ad' or 'advertisement'. By labelling everything in a way that doesn't reference common naming conventions for ads causes this to work. You can try it yourself with notepad using div tags or image tags that reference a folder like 'advertisement'.

>> No.64384402

>>64384300
long[] sumarray;
sumarray = new long[array.length];

Looks like you fell for the arrays are pointers meme

>> No.64384457

>>64384399
so when you click on the image, where does it go to?

do you make money when a user clicks on it?

>> No.64384476
File: 353 KB, 1297x440, nope.png [View same] [iqdb] [saucenao] [google] [report]
64384476

>>64384399
Poof, no ad anymore.
Nothing is stopping me from adding your website to a couple of common ad block lists so that no ad will show up no matter what pointless trickery you decide to waste your time on.
But I won't do that, because I'm not a bad guy, but it's a possibility :^)

>> No.64384519

>>64382988
>not anime thread
shit bread

>> No.64384546
File: 307 KB, 1141x1439, ujimatsu_chiya_gochuumon_wa_usagi_desu_ka_drawn_by_maru_usagi_maruusagi22__530cfa4e1c32439efbc1515fd.jpg [View same] [iqdb] [saucenao] [google] [report]
64384546

Which one is better? MIT's SICP lectures or UC Berkeley's CS61A SICP lectures?

>> No.64384561

Should I use github even if it's only for myself? I am the guy that wants to practice programming and make the app for a friend.
I've complied some of my ideas that I will show him and ask him how he would want it to look like, but if I actually work on it I will probably needs some place to have multiple version stored in case a change is bad or something, I guess?

>> No.64384572

>class="ad1-container"
>adblock proof
top jej

>> No.64384581

>>64384546
Why are you this way?

>> No.64384587

>>64384546
berkeley

>> No.64384598

>>64384561
>I've complied some of my ideas that I will show him and ask him how he would want it to look like, but if I actually work on it I will probably needs some place to have multiple version stored in case a change is bad or something, I guess?
so pure, holy shit

>> No.64384604

>>64384572
hey it worked. Don't knock what actually fucking works.

>> No.64384634

>>64384604
works until it doesn't

>> No.64384772
File: 776 KB, 2048x833, 1500969834115.png [View same] [iqdb] [saucenao] [google] [report]
64384772

>> No.64384798

>>64384020
>$r = 0;
while ($r < 1) {
$r++;
}

Use a for loop

>> No.64384873

/dpt/ is absolute shit today

what's going on?

>> No.64384885

>>64384083
>Mojolicious
WHY

>> No.64384890

How can I abuse templates to determine if a particular type is callable with a certain argument list?
In other words:
struct Functor
{
void operator()();
void operator()(int);
};

isCallable<Functor> // true
isCallable<Functor, int> // true
isCallable<Functor, int, int> // false

>> No.64384893

Shitty languages are the future of quitting programming

>> No.64384897

>>64384873
/dpt/ is always absolute shit

>> No.64384920

>>64384798
the results for advertisements are not a quantifiable amoutn as it can grow. So this required a 'while' loop also in the future there is a possibility I may put in multiple ads.

>> No.64384946

>>64384920
Why exactly can't you use a for loop there? Give me an example

>> No.64384964

>>64384885
What's wrong with it?

>> No.64384970

>>64384946
So I guess you could use a for loop. I didn't use a for loop because I don't know what is the max amount of advertisements initial number.
for($i=0; $i<(either need to pull a count of full array or just use while loop); $i++){

}

versus a simple while loop that will keep going till it's done through the SQL results.

>> No.64384989

>>64384561
yes, for data preservation. for private repos, bitbucket is more interesting.

>> No.64385066

I'm having trouble understanding how to calculate the Big-O of programs. Can someone help me out here? ELI5

>> No.64385088

>>64384890
template <typename T, typename ... TS>
struct IsCallable {
using Result = decltype(std::declval<T>()(std::declval<TS>()...));
}

>> No.64385103

>>64385066
example?

>> No.64385137

>>64385066
Measure execution time at eg. problem sizes 5, 10 and 20 entries or whatever it depends on.
Plot the execution time vs. the problem size
It should now be obvious whether it is O(n) or O(n^2) etc

>> No.64385175

Can 2 foreign keys be a primary key

>> No.64385182

>>64383927
Working on it right now. A bit alien as far as ISAs go, though.

>> No.64385215

Why is this giving me segfault?
#include <stdio.h>

int main() {
int * a; *a = 22;
int b = *a;
printf("b = %d\n", b);
*a = 30;
printf("*a = %d, b = %d\n", *a, b);
}

>> No.64385230

>>64385215
a points to some random adress you don't own. Use malloc

>> No.64385232

>>64385215
>int * a; *a = 22;

You didn't allocate 'a'.

>> No.64385234

>>64385088
<,...>
{
=(::<>()(::<>()...));
}

literally nightmare fuel

>> No.64385283

>>64385215
#include <stdio.h>
#include <stdlib.h> // Malloc

int main(int argc, char **argv)
{
int *a, b;

a = malloc(sizeof(int));
if (!a)
return 1;

*a = 22;
b = *a;

printf("b is %d\n", b);
*a = 30;
printf("*a is %d, b is %d\n", *a, b);

free(a);

return 0;
}


>> No.64385316

>>64385232
>>64385230
>>64385283
Thanks, midgets.

>> No.64385325

>>64385316
>midgets
That really rustles my jimmies

>> No.64385329

>>64384598
Sorry for being a noob, ill get the hang of it I promise

>>64384989
Ill give both a look, thanks a lot

>> No.64385341

>>64385283
>if (!a) ..
>free(a)
why?

>> No.64385345

>>64384587
Thanks

>> No.64385350

>>64385341
Allocations can fail

>> No.64385452

Best C++ resource for learning by practice problems? I bought C++ Primer (Lippman) but it goes into great detail about the technicals, but the problem sets are lacking

>> No.64385535

>>64384519
YOU SHUT YOUR WHORE MOUTH WHEN GARY KILDALL IS TALKING

>> No.64385576

>>64385283
main = alloca (\a -> do
poke @Int a 22
b <- peek a
printf "b is %d\n" b
poke a 30
a' <- peek a
printf "*a is %d, b is %d\n" a' b)

>> No.64385619

>>64385283
>>64385576
fn main() {
let mut a = Box::new(22);
let b = *a;
println!("b is {}", b);
*a = 30;
println!("*a is {}, b is {}", a, b);
}

>> No.64385624

>>64385234
>::<>
oh shit i thought it was rust for a sec

>> No.64385640

>>64385619
really rust-les my jimmmies

>> No.64385807

>write a function that recieves a floating point number and sends back the integer and fraction parts
>i have to do this in C
hello darkness my old friend, i want to do this in scheme or lisp
it would be as simple as a #'ROUND 'ing that numba ....

>> No.64385885

>>64385807
man modf

>> No.64385889

>>64385807
Steal https://github.com/python/cpython/blob/9b6c60cbce4ac45e8ccd7934babff465e9769509/Objects/floatobject.c#L1535

>> No.64385912

>>64385889
No actually this implementation is very shitty. Go for >>64385885

>> No.64386046

>>64384010
ok so basically \n is being literally interpeted as two chars rather than a single one
Coding from the hip you can try to instead define some char like ";" or "," to designate where the data should be separated, if you really want to insert it all on one line (separate vars are much better my man).

...
data = fill.split(";")
for dataline in data:
dataline = dataline.strip()
test.write(dataline + "\n")

test.close()

>> No.64386090

>>64386046
>ok so basically \n is being literally interpeted as two chars rather than a single one
What? Your computer is haunted.

>> No.64386124

>>64386046
>two characters
You mean literally backslash then lowercase n or it's the DOS end-of-line quirk?

>> No.64386274

>>64386090
>>64386124
Yes, the inputs end up being literal ascii 92 and 110, rather than 10

>> No.64386304

>>64385088
Ooh, that's decent.

>> No.64386310
File: 100 KB, 320x320, jojo thonk.png [View same] [iqdb] [saucenao] [google] [report]
64386310

>>64382988
Whats a good program for easily making GUI mockups? no wireframes, actual gui mockups with designs/etc

>> No.64386324

>>64386310
MS Paint, alternatively paper + pencil.

>> No.64386340

>>64386304
this _might_ work for finding out if it can be called
template <typename T>
struct IsCallable<T> {
using OpType = decltype(T::operator());
}

>> No.64386367

>>64386340
But that only works with function objects, doesn't it?

>> No.64386376

>>64386310
whiteboards are neat.
proto.io seems okay-ish. Some people use photoshop too.

>> No.64386469

>>64386367
i dunno but you could have something like
template <typename T, typename TS>
struct IsCallable<T(*)(TS...)> {
using OpType = T(*)(TS...);
};

>> No.64386485

>>64385807
remember to check for overflows, friend
#include <utility>
#include <cmath>
#include <cfenv>
#include <optional>

auto splitf(double num) -> std::optional<std::pair<int, double>> {
double y;
double x = std::modf(num, &y);
if(y > std::numeric_limits<int>::max() ||
y < std::numeric_limits<int>::min()) {
return {};
}
return std::make_pair(y, x);
}

>> No.64386511

>>64386376
I want to do a mockup for a desktop application

also I would use photoshop/gimp but I don't really have any idea where to get resources

>> No.64386529

>>64386485
can you not return {y,x}?

>> No.64386548

>>64386529
you can

>> No.64386550
File: 103 KB, 450x738, 1516375848853.jpg [View same] [iqdb] [saucenao] [google] [report]
64386550

which one are ya

>> No.64386565

>>64386550
greybeard

>> No.64386567

>>64386550
chris but with better posture

>> No.64386572
File: 69 KB, 1024x768, 1483196133653.jpg [View same] [iqdb] [saucenao] [google] [report]
64386572

>>64386550
>tfw i'm not on the list
why leave me out

>> No.64386583

>>64386550
profession or as in "Looks like"?

>> No.64386592

>>64386572
what are ya
>>64386583
whatever ya want

>> No.64386605

>>64386550
bottom left in the streets
bottom right in the sheets

>> No.64386627

>>64386605
>a cuckold in the sheets

>> No.64386659

>>64386627
if any of those guys is a cuck it's definitely shannon

>> No.64386666

>>64386529
A yes, forgot about that. I can only get it to work like this:
return {{y, x}};

>> No.64386711

void testVariant3(Variant<int, std::string, int> &vref)
{
vref.match(
[](Index<0>, int){ puts("First int"); },
[](_, int){ puts("Final int"); },
[](_, auto&){ puts("String"); }
);
}

sepples can have pattern matching too!

>> No.64386772

The vast majority of additions being made to a language are just junk.
For example look at this trash;
>>64386711

>> No.64386793

return {{{{{{{{{auto&& dingus, fart...()}}}}}}}}}}}};

>> No.64386795

>>64386711
There's so much fucked up template machinery going on here. I wonder how bad the error message would be if you slightly fucked up

>> No.64386865

>>64386772
You should see the variant which actually made it into the standard.

>> No.64386875

>>64382988
I see a few open source service status pages/dashboards but none of them come with yum/deb packaging. Anyone know of one that is easy to install?

>> No.64386972

Fucking hell I wish I wasn't such a brainlet, OpenGL is driving me nuts.

>> No.64386993

>>64385234
What brainfuck derivative is this?

>> No.64387063

>>64385175

>> No.64387091

>>64386993
>What brainfuck derivative is this?
C++.

>> No.64387213

>>64387063
works on sqlite3

>> No.64387247

>>64387091
the most esoteric brainfuck dialect there is

>> No.64387275

>>64383927
>Anon, share a similarly ambitious dream
doing retarded pointless shit isn't ambitious

>> No.64387281

What's the opposite of Brainfuck?

>> No.64387313

>>64387281
Psuedo-code.

>> No.64387318

>>64387281
lisp

>> No.64387324

>>64387281
shakespeare programming language

>> No.64387338

>>64382988
So, what's the reason?

>> No.64387352

>>64383702
It didn't.

>> No.64387379

>>64387281
unlambda

>> No.64387422

>>64387318

Lisp the greatest programming language ever created

>> No.64387505

>>64387281
>What's the opposite of Brainfuck?
https://github.com/adrianliaw/fuckbrain

>> No.64387516

Okay so there is _Generic in c but why couldn't they just make it proper block structure that would also support type names and returns?
// current _Generic
int x;
_Generic(x, // doesn't support raw type, has to be variable
int: abs,
long: labs
)(x);
// expands -> abs (x);

Technically you could write
_Generic(x, int: abs(x), long: labs(x));
but clang will give warning from that.

What it could be
void *p = _Generic(int) { // parameter is variable or type
int: {
int *tmp = malloc(sizeof(*tmp));
tmp;
}
char: {
char *tmp = malloc(sizeof(*tmp));
tmp;
}
}

>> No.64387557

>>64387516
this is why the superset language is used

>> No.64387659

>>64387557
No but what the fuck is the standard committee thinking?

>> No.64387717

https://discord.gg/4TuhPhr

>> No.64387726

>>64387717
Forgot to add
We have a Discord

>> No.64387756

>>64384203
what is the point of shoehorning coin mining into everything? why is this something people would be interested in doing

>> No.64387942

can I make iOS app for my buddy's business without having a mac?

>> No.64387974

Is there any difference execution/speedwise between

if a in bar or b in bar or c in bar or d in bar or e in bar
baz


vs

for foo in [a,b,c,d,e]
if foo in bar
baz
break

>> No.64387991

>>64387942
install osx in virtualbox

>> No.64387996

typescript will save systems programming

>> No.64388021

>>64387942
xamarin or react native

>> No.64388096

Difference between
int * a[10];

and
int (*a) [10];

>> No.64388128
File: 45 KB, 750x1334, 1eovth7c1mbz.jpg [View same] [iqdb] [saucenao] [google] [report]
64388128

>>64382988
WHY THE FUCK ARE THE STRINGS IN FUNCTION 9 TERMINATED BY A DOLLAR SIGN???

>> No.64388133

>>64387974
Is that Python? I wouldn't be surprised if the Python interpreter is too dumb to do some basic loop unrolling. In any reasonable implementation of any reasonable language, there would be no difference even on the most basic optimization level.

>> No.64388164

>>64388133
It's actually a scripting language for a game which is like half a programming language. I'm probably going to do it anyway and just eat whatever performance cost is there because the existing script I'm trying to cleanup is so godawful.

>> No.64388179

>>64388096
An array of 10 pointers to ints
vs
A pointer to an array of 10 ints

>> No.64388183

>>64388096
First is an array of 10 int pointers.

Second is a pointer to an array of 10 integers.

>> No.64388258

>>64387991
cant i just make a dualboot?

>> No.64388282

>>64384873
Friday.

>> No.64388323

>>64388258
no, because the os has a copy protection which checks for the presence a particular piece of hardware. virtualbox can emulate that by hidden options. google it

>> No.64388421

>be go developer
>import code from GitHub in my code
>GitHub is down
>code no work
>mfw no face

>> No.64388423

>>64388323
alright thanks

>> No.64388465

>>64388421
>not vendoring deps

>> No.64388646
File: 11 KB, 501x504, merchant.gif [View same] [iqdb] [saucenao] [google] [report]
64388646

>>64388421
>compile code into a .dll
>package the library with the software
>claim you made everything
>charge more

>> No.64388700

Are there any languages that are lower level than C, but higher than Assembler?

>> No.64388712

>>64388700
forth maybe?

assembly with loads of macros i.e. using fasm?

>> No.64388795
File: 1.71 MB, 1280x720, car.webm [View same] [iqdb] [saucenao] [google] [report]
64388795

>>64388646
is that legal?

>> No.64388864
File: 78 KB, 447x723, 1511388152220.jpg [View same] [iqdb] [saucenao] [google] [report]
64388864

Pygame keeps crashing whenever I use the one input that's programmed into the game
HELP

>> No.64389093 [DELETED] 

fopen(stdin, ...) ?

>> No.64389094

>>64388700
fortran

>> No.64389145

>>64389093
no.

>> No.64389293

>>64384546
She's really cute.

>> No.64389327

>>64388864
Learn how to debug

>> No.64389363

>>64384546
berkeley is doing this "we have our own sicp in python" thing and i don't like it
http://composingprograms.com/

>> No.64389445

Who LISPers hate scheme's hygenic macros? Aren't they better?

>> No.64389568

>>64386659
This
>glasses
>bald
>hawaiian shirt
>nervous smile
He's a cuck.

>> No.64389581

>>64388164
ffs just check if the set intersection ({a,b,c,d,e} and bar) is non-empty
alternatively, in a sane language
if ([a,b,c,d,e].any {_ in bar}) baz

>> No.64389618

>>64386711
bloody hell, at least line em up
sepples already has a bit of an issue with readability, no sense in making it worse unnecessarily
void testVariant3(Variant<int, std::string, int> &vref)
{
vref.match(
[](Index<0>, int ){ puts("First int"); },
[](_ , int ){ puts("Final int"); },
[](_ , auto&){ puts("String" ); }
);
}

>> No.64389649

>>64389445
I don't hate them, and I use CL mostly.

>> No.64389740
File: 356 KB, 900x1200, 1453424091201.jpg [View same] [iqdb] [saucenao] [google] [report]
64389740

>>64389327
I figured it out.
No thanks to you though, punk

>> No.64389813

http://codepad.org/ux65lGz5

did a software blitter

>> No.64389818

Rust is even less readable than Sepples.

>> No.64389840

>>64389818
The purpose of rust was to try to one-up sepples on everything, they succeeded on that one.

>> No.64389864

>>64389840
And failed on everything else.

>> No.64389886
File: 208 KB, 738x1076, Screen Shot 2018-01-20 at 13.06.36.png [View same] [iqdb] [saucenao] [google] [report]
64389886

What am I doing wrong, guys?

>inb4: using python

>> No.64389921

If you could add 1 (one) feature to C, what would it be and why?
Alternatively, you can remove one feature from C.

>> No.64389924

>>64389886
You forgot to register your proprietary text editor.

>> No.64389931

>>64389921
Make it a lisp.

>> No.64389940

>>64386310
PowerPoint

>> No.64389960

>>64389921
Upgrade the preprocessor, it sucks. Just a little bit more and you could implement a bunch of shit on top of C.

>> No.64389973

>>64389886
using python
but also, why are you doing
>callable(shite)
when shite is not callable?

>> No.64389986

>>64389973
to check it :/
why is it no callable tho?

>> No.64389992

>>64389973
sure, but it should still just return False for him

>> No.64389993

>>64389986
do you understand what 'callable' means?

>> No.64390013

I'm confused about volatile in C/C++ (as far as I understand they're the same in this keyword).
There's so many sources that seem conflicting. Many sources say that volatile has nothing to do with multithreading.
Others are more nuanced yet very negative to the idea:
https://software.intel.com/en-us/blogs/2007/11/30/volatile-almost-useless-for-multi-threaded-programming
And if you just scroll down to the comments you can see people defending volatile.

I really want to know a good way to understand (good) code written to use volatile. I don't find it likely that I would use it myself the idea of having individual variables reflected in the memory of other cores but not others is something I don't think I'm likely to do. But I'm likely to be reading code that uses the keyword at one point or another and I need some way to understand the intent behind the use and if it's valid or not.

So my understanding as it is is that volatile guarantees that if i read or write from the variable it's a read/write that will be processor synchronized. Not atomic or anything, just synchronized so that if I were to read the variable from another thread on another core after the variable was set in the first thread I'm reading the value I put there. Which could potentially be stored in the store buffer of the core otherwise. But it does not do memory ordering (except for with other volatile variables? i.e. if you have two volatiles they're written to in order of the writes in code).

Also as I'm writing this does it ever happen that your thread jumps cores due to OS scheduling and you lose unsynchronized variables?

>> No.64390019

>>64389973
ahaha, I'm retarded
but so are you:
>>64389986
>>64389992

look at the error message, you naggers
line 25, what do you think 'map' resolves to?
hint: great naming on line 41, champ

>> No.64390022

>>64389993

A callable is an object allows you to use round parenthesis ( ) and eventually pass some parameters, just like functions.

>> No.64390030

>>64390022
very good, now see >>64390019

>> No.64390043

>>64389886
I don't know python but it seems pretty clear. On line 41 you've constructed a "BaseMapImager" (I assume, dynamic typing, who knows). And on line 25 you're calling the 'BaseMapImager'.
Just the naming of these doesn't seem quite right.
If you were aiming to use:
http://book.pythontips.com/en/latest/map_filter.html
You've shadowed that function call with your variable name 'map'.

>> No.64390047

>>64390019
i was dealing with a specific concern: the function returning something uncallable wouldn't cause a crash. nice eyes but otherwise i think you're a prick

>> No.64390048

>>64390013
volatile just suppresses optimizations that make assumptions about what the value will be.

volatile int a = 1;
b = a + 1;


Seems a simple optimization, just set b = 3, volatile suppresses that.

Most of the time you see volatile it's used wrong, there's very few uses for it and almost none in a user program.

>> No.64390051

>>64389921
__python {}

>> No.64390053

>>64390048
b = 2, I'm fucking retarded

>> No.64390064
File: 31 KB, 487x291, Screen Shot 2018-01-20 at 13.29.15.png [View same] [iqdb] [saucenao] [google] [report]
64390064

>>64390019
it creates dictionary

>> No.64390074

>>64390047
>otherwise i think you're a prick
oh you're adorable
you have any clue where you are, luv?

also, a bit of mockery over such a brainfart is gonna connect that memory with more emotion in your excuse of a brain
might make it more likely to give you a stop (and have you remember this) next time you're about to fuck up your naming that bad
science, bitch

>> No.64390079

>>64390064
assuming the tard hasn't shadowed 'map'

>> No.64390086

>>64390074
i know where i am. i didn't post that code

>> No.64390089

>>64390048
>suppresses optimizations
Well it's broader than that I'm lead to believe. That's covered in "volatile guarantees that if i read or write from the variable it's a read/write that will be processor synchronized". Meaning it has to read the actual memory location every time and can't use register caching or any caching.
If it were just suppressing optimizations about assumptions (such as constant folding, or maybe even UB-bounds like with uint and overflow) it wouldn't imply cross-core synchronization of any type and you could have a variable that days old sitting in one processor that was supposed to be processor visible at this point. Theoretically, I have a hunch that doesn't happen but you get my drift.

>> No.64390100
File: 22 KB, 336x250, Screen Shot 2018-01-20 at 13.34.28.png [View same] [iqdb] [saucenao] [google] [report]
64390100

>>64390043
>And on line 25 you're calling the 'BaseMapImager'.

i dont it looks fine...

>> No.64390101

>>64390086
and being completely useless to the poor sod's original issue

>> No.64390103

>>64390013
jesus christ you didn't have to type out an entire essay

anyways, volatile means that the variable will be affected by things not obvious to the compiler. it disbles optimizations on it. that guarantees visibility of changes accross threads.

>So my understanding as it is is that volatile guarantees that if i read or write from the variable it's a read/write that will be processor synchronized.
the term "synchronization" implies some locking scheme or atomics

>does it ever happen that your thread jumps cores due to OS scheduling
or interrupts, it happens a couple thousand times a second.

>and you lose unsynchronized variables?
You don't "lose" anything whenthreads are descheduled or migrate cores

>> No.64390113

>>64390103
fuck I wanted to say
>the term "synchronization" implies some locking scheme or atomics, DONT USE IT IN THIS CONTEXT

>> No.64390114

>>64390101
do you come here to pick fights?

>> No.64390128

>>64390013
From what I understand volatile was introduced for things like interacting with hardware in situations where multi-threading wasn't even a thing. So the usage of volatile for multi-threading seems intuitive, but it's a hacky solution using it for something it was never intended to be used for and there are more appropriate ways to deal with multi-threading.

>> No.64390132

>>64390043
looks like you're overestimating the mentally challenged (>>64390100)

>>64390100
ffs just rename yer shitty object on line 41, so it doesn't shadow 'map', and rerun
jesus, I'm enabling these guys with the spoonfeeding, aint I

>>64390114
:*

>> No.64390151

>>64390013

You already have some answers, but are some specific use cases.

It's commonly used in embedded systems where you have external hardware which will modify program variables (register definitions).

Another example is also in interrupts where you may set a flag which needs to be visible in the your main loop, but which is modified by hardware. This needs to be volatile since the should_print variable can be modified at anytime during program execution (via interrupt) and so a load always needs to be performed.

volatile int should_print = 0;

int main(void)
{
while (1) {
if (should_print) {
printf("interrupt received\n");
}
}
}

__attribute__ ((interrupt))
void isr(void)
{
should_print = 1;
}

>> No.64390158

>>64390089
You don't use volatile for multithreading, or preemption stuff. You have a bunch of atomic shit that can cover that.

volatile, as I understand it, was meant for a single purpose. Here's an example, let's say you're targeting the BIOS or whatever and the interface given to you for the clock is to read from some address.

volatile uint16_t *tick = (uint16_t *)0xBEEF;

With that keyword you know that when you use *tick, it will always be the clock, set by the chip and not some optimization.

>> No.64390196

>>64390103
>volatile means that the variable will be affected by things not obvious to the compiler. it disbles optimizations on it.
> that guarantees visibility of changes accross threads.
bullshit, volatile doesn't guarantee atomicity
>>64390089
>Well it's broader than that I'm lead to believe. That's covered in "volatile guarantees that if i read or write from the variable it's a read/write that will be processor synchronized
you've been mislead

https://software.intel.com/en-us/blogs/2007/11/30/volatile-almost-useless-for-multi-threaded-programming
tldr volatile/atomicity/memory consistency aint the same shit

>> No.64390205

>>64390196
>bullshit, volatile doesn't guarantee atomicity

Atomicity and visibility are not the same things.

>> No.64390209

>>64386793
good post my friend

>> No.64390211

>>64390103
>the term "synchronization" implies some locking scheme or atomics
I didn't mean that. I just meant visibility across cores. Maybe it's called that. I'm new to the terminology.
>You don't "lose" anything whenthreads are descheduled or migrate cores
Ok. Well I'm not sure what the entire process is or if there's something general to know across OSes. I was thinking that if I wrote to memory somewhere, I get interrupted in one thread on one core. Execution resumes on another core. Since there's the concept of memory barriers if you hadn't hit one when the execution was halted is there any way to have institution that'd get the old pre-modified variable?
Your answer says no. I just wanted to explain my thinking because I'm not sure it was clear, with me confusing synchronization and visibility (as I call it).
>>64390128
Yes memory barriers almost seem straight up better to use. But they cover all stores/loads up to that barrier. Volatile seems to imply it's more granular.
>>64390196
Well I've used the wrong word apparently. I meant visible across cores.

>> No.64390215

>>64390196
to quote from the link:
>You might think the solution is to mark all your memory references volatile. That's just plain silly. As the earlier quotes say, it will just slow down your code.
> Worst yet, it might not fix the problem. Even if the compiler does not reorder the references, the hardware might. In this example, x86 hardware will not reorder it.
> Neither will an Itanium™ processor, because Itanium compilers insert memory fences for volatile stores. That's a clever Itanium extension.
>But chips like Power™ will reorder. What you really need for ordering are memory fences, also called memory barriers. A memory fence prevents reordering of memory operations across the fence, or in some cases, prevents reordering in one direction. Paul McKenney's article Memory Ordering in Modern Microprocessors explains them.
> Sufficient for discussion here is that volatile has nothing to do with memory fences.

>So what's the solution for multi-threaded programming? Use a library or language extension hat implements the atomic and fence semantics. When used as intended, the operations in the library will insert the right fences. Some examples:

>> No.64390232

>>64390211
>is there any way to have institution that'd get the old pre-modified variable?
Poorly phrased and typos. I meant to ask if there's a way for me to get the old pre-modified value because I moved cores, basically.
Thinking that the new core is out of date compared to the old one because no barrier was hit.

>> No.64390236

>>64390211
>memory barriers almost seem straight up better to use. But they cover all stores/loads up to that barrier. Volatile seems to imply it's more granular.
read up on the C++11 memory model, relaxed atomics etc
https://herbsutter.com/2013/02/11/atomic-weapons-the-c-memory-model-and-modern-hardware/
volatile's exactly the wrong tool for the job

>> No.64390245

>>64390132
>ffs just rename yer shitty object on line 41, so it doesn't shadow 'map', and rerun
jesus, I'm enabling these guys with the spoonfeeding, aint I

you could have said it from the begging instead of making a drama

>> No.64390247

I recently got asked to do some VBA shit for Access to help another group at work. I hardly know VBA and avoid that shit like the plague. I have used several different languages, and everything from front to back end and even procedural languages for DB. I know there is a lot of hate for MS shit around here and I always figured it was just part of the usual bantz, but holy shit the docs are absolutely terrible. I legitimately have encountered shit written in broken english by chinks and slavs that were more coherent than that shit!

>> No.64390249

>>64390245
He did though.
Multiple people did.
You had your problem explained to you and you refused to listen.

>> No.64390252

>>64389886
why is your font rendering fucking hideous?
is that what macos actually looks like or is that just a mac theme for some linux de

>> No.64390255

>>64390245
>you could've just spoonfed me immediately
ah, I see you're not only dumb, but also stubbornly avoiding any chance to learn
great perspective ahead of ya with that approach, m8

>> No.64390262

>>64390249
this is the type of guy that's giving the python community that certain reputation, it seems

>> No.64390263

>>64390247
i'm sorry, my fellow employed brethren. we write in delphi here. i guess it isn't as bad as vba, but it's painful.

>> No.64390266

>>64390255
all i learnt that there are some arrogant faggots who full of themselves

>> No.64390269

>>64390211
Okay Imagine you have some boolean and in some loop you say:
bool condition = false;
...
while (!condition);


Even if you DO change the value of conditon somewhere, the compiler may optimize that away so that it errornously becomes an infinite loop because it doesn't see the outside change.

How does that work? Maybe it got optimized completely away, or the value is loaded into a register and repeatedly just tested against. This obviously means that the wont see a change to the variable representation in memory becuase it keeps testing against a register.
Volatile requires you to reload and store that variable to memory every time which guarantees visibility of changes at some point.

That is not the same as atomicity - you can kinda race on a volatile but it probably doesn't even matter.
But to handle race conditions you need either locks or atomicity.

The OS guarantees that a thread is correctly suspended and resumed when scheduling threads. The only implication that scheduling has for concurrency in your program is that a thread that holds a lock may be paused for a lengthy period of time which obviously prevents progress in other threads that need the same lock object.

>> No.64390285

>>64390266
continuing to avoid taking responsibility for your fuckups, I see

m8 if you think anyone of us thinks they're infallible hotshit, you're retarded. We're all retarded from time to time, the difference is we don't deflect and get butthurt, instead (ideally) we admit we're retarded and use the lesson to avoid repeating the same fuckups
give it a shot

>> No.64390287

>>64390013
>I'm confused about volatile in C/C++ (as far as I understand they're the same in this keyword).
Correct.

Marking a variable as volatile does the following, and nothing else:
It tells the compiler "This variable might change its value underneath you in a way you can't predict. Maybe it's not actually a variable so much as a reference to a piece of hardware, or maybe an interrupt handler will write to it somehow. When optimizing, make sure my code behaves *as written* with that in mind." In practice, this just means the compiler has to turn off a lot of optimizations where your variable might be involved.

>Many sources say that volatile has nothing to do with multithreading.
It does have something to do with multithreading, for multithreading is one way variables might change underneath you. However, for various reasons, it is practically impossible to solve any of the common multithreading problems using volatile variables; if you think you can make your own synchronization system using volatile variables or something, you are wrong. So you would be well advised to not think of them in thready contexts, for they add nothing.

>I really want to know a good way to understand (good) code written to use volatile.
Unless you are writing a kernel or device driver or similar piece of low-level code (maybe something embedded), you are not going to find any, for there are no high-level problems you can solve with volatile variables.

A GOOD example of a volatile variable goes like this:
volatile int* this_address_is_actually_mapped_to_a_device_register_not_a_piece_of_memory = get_register();
*this_address_is_actually_mapped_to_a_device_register_not_a_piece_of_memory = 17; // send a command to the hardware
int result = *this_address_is_actually_mapped_to_a_device_register_not_a_piece_of_memory;
if (result == 5)
print("success!\n");
else
print("oh noes it broke\n");


Device drivers do that shit. User mode programs never do.

[continued]

>> No.64390293

>>64390287
[continued]


>So my understanding as it is is that volatile guarantees that if i read or write from the variable it's a read/write that will be processor synchronized. Not atomic or anything, just synchronized so that if I were to read the variable from another thread on another core after the variable was set in the first thread I'm reading the value I put there.
No, that is not a guarantee.

>But it does not do memory ordering
It will. That's also not something volatile suppresses. That's what memory barriers are for, which volatile variables do not imply.

>>64390128
>From what I understand volatile was introduced for things like interacting with hardware in situations where multi-threading wasn't even a thing.
Indeed. Interrupts were a thing, though. And when those are involved, using volatile is often not enough.

>So the usage of volatile for multi-threading seems intuitive, but it's a hacky solution using it for something it was never intended to be used for and there are more appropriate ways to deal with multi-threading.
More importantly, it doesn't work. You cannot build correct thread-safe code using volatile as your mechanism. I *think* that even combined with other primitives such as memory barriers, volatile never actually adds anything (i.e. if you have a correct thread-safety system that uses volatile, and you strip the volatile away, it is always still correct), but I am not positive on that.

>> No.64390314

>>64389921
garbage collection

>> No.64390354

>>64390247
>VBA
I know your pain.

>> No.64390361

>>64390314
ur mum needs garbage collection

>> No.64390383

>>64390269
>>64390287
Thanks a bunch this is much clearer now.
>>64390293
>No, that is not a guarantee.
I won't bother speculating, clearly hadn't been that productive. What's the specific problem here?

>> No.64390384

>>64390361
gonna need more than just a garbage collector to clean up the mess after I blew my load in that cumdumpster

>> No.64390414

>>64390384
take your garbage semen complaints to yer urologist

>> No.64390428

>>64390384
People who want garbage collection are quite nasty.
>incestuous son calling his mother a cumdumpster

>> No.64390463

>>64390428
at least they're more civilized than the sickos that want to "manually manage" said cumdumpster

>> No.64390503

>>64390013

This is the kind of thing Volatile is for:
unsigned short *vga_text_buffer = 0xB8000;
*vga_text_buffer = 0x9700;


It suppresses optimizations so that when you have to deal with things like, say, DMA-based I/O, the compiler doesn't try and get smart and find something it thinks is equivalent, but isn't.

It has nothing to do with multi-threading. In fact, if you aren't trying to talk directly to hardware, go ahead and forget it exists.

>> No.64390528

>>64390383
>I won't bother speculating, clearly hadn't been that productive. What's the specific problem here?
Ah, I see that I didn't read that quite correctly.

The volatile keyword DOES ensure that other threads will actually read what you wrote (though as you say, not necessarily in an atomic way). It does not, however, ensures that this happens at a particular time relative to other memory accesses you might do in the vicinity, especially from the point of view of some other processor. Thus, you cannot use this to control access to any OTHER piece of shared state, even other atomic variables; for the volatile reads and writes are not memory barriers, and both the compiler (for non-volatile other variables) and the processor (even for volatile other variables!) may reorder access to those shared resources around it. So while the volatile variable does reliably get some form of communication across to a different thread, it is close to impossible (and I suspect *actually* impossible) to use that to build meaningful cross-thread communication.

>> No.64390536
File: 235 KB, 1024x723, .jpg [View same] [iqdb] [saucenao] [google] [report]
64390536

using i2c to communicate between two embedded systems, we used to use serial and communicate in plaintext
move.01.90.10000\0

wondering how we can do it more efficiently than using human readable
thinking something like hashing all the possible command names and sending that

I dont want to naively just make the commands have 1 - 2 char names like a b c and then a1 a2 ect
speed isn't an issue yet at all, but just interested in what is the correct solution

>> No.64390552

>>64390528
I see. Perfect. I think I understand this well now.

>> No.64390598

>>64390536
compress commands (huffman, arithmetic coding, whatever - even utilize ideas from existing compression algos) at build time, have protocol versions, produce lookup tables to be used in sender/receiver?

>> No.64390633

>>64390536
I wouldn't overcomplicate it and just assign commands an integer value ascending in value. Have a common header for defines mapping command name -> integer and a switch (or perfect hash table) for the reverse.

If you had potentially a lot of commands > 256, you could use a marker byte so your most common 128 commands were 1 byte and the rest 2 or more.

>> No.64390761
File: 1.29 MB, 1592x1200, .png [View same] [iqdb] [saucenao] [google] [report]
64390761

>>64390598
https://stackoverflow.com/a/9842857
might do something like this

>> No.64390773

>>64387275
this is a bully-free zone, please kys faggot

>> No.64390865
File: 1.02 MB, 1896x2507, 1513112715251.jpg [View same] [iqdb] [saucenao] [google] [report]
64390865

>>64389363
I meant these lectures which still follows sicp

https://archive.org/details/ucberkeley-webcast-PL3E89002AA9B9879E?sort=titleSorter

>> No.64390921

I found this trick to speed up my C code.
#define __builtin_expect(a,b) b

>> No.64390960

>>64390865
was she always that short

>> No.64391104

>>64390921
but that's retarded

>> No.64391381

>>64390921
But that doesn't actually tell the compiler what to expect.
Unless that was your point.

>> No.64391497

>>64389931
It already is

(int* (a, b) (c,d) )

>> No.64392000

I wish emacs have go to function definition feature.
It's really annoying to open a file only to fix a function, but it's really hard to go to the function's definition because the find pointing to tons of function call.

I wan't to create the script myself but not good with ELips

>> No.64392039

>>64392000
I'm not an emacs user but what about the tags file? ctags is what I use in vim.

https://www.emacswiki.org/emacs/EmacsTags#tags

>> No.64392224
File: 102 KB, 241x228, 1508064634603.png [View same] [iqdb] [saucenao] [google] [report]
64392224

>>64382988
>Gary Kildall died due to a blow to the head soon after that quote
>"The exact circumstances of the injury remain unclear."

>> No.64392230

>>64388128
$ was a string terminator in CP/M and certain assemblers. Probably related to that.

>> No.64392242

Is there like, an industry standard book on networking?

>> No.64392253

>>64392242
Oh, I mean networking like actually writing low level protocols and stuff, not interacting with other people. Fuck that shit.

>> No.64392358

>>64384890
http://en.cppreference.com/w/cpp/types/is_invocable

>> No.64392467

>>64390865
I love Twilight Sparkle!

>> No.64392619

>>64389094
It's a popular misconception that Fortran must be "lower level" than C, because it tends to perform better for numerical tasks.

It's actually much higher level - the reason for the performance is that the language is /by design/ easier to compile into efficient machine code (again, for numerical tasks).

>> No.64392638

>>64392242
>>64392253

https://intronetworks.cs.luc.edu/current/html/

>> No.64392662
File: 41 KB, 771x369, PqZ0YOUs4BtH_pol.png [View same] [iqdb] [saucenao] [google] [report]
64392662

>>64392619
It's also important to bear in mind that Modern Fortran has substantial OO features.

>> No.64392696

void type was a mistake

>> No.64392721

>>64392696
void is not a type

>> No.64392736

>>64392721
exactly

>> No.64392903

>>64392242
TCP/IP Illustrated, Vol 1, 2nd edition

>> No.64392966

>>64392903
>Illustrated

Are the packets wearing bikinis?

>> No.64393085
File: 169 KB, 660x751, 1485101806441.jpg [View same] [iqdb] [saucenao] [google] [report]
64393085

>Google runs a private TCP/IP network for their own services that bypasses Tier 1 ISPs and directly peers with regional and access ISPs

Whew, they really do got their tendrils everywhere.

>> No.64393090

>>64393085
Doesn't like, nearly every big business, especially big tech business, do this?

>> No.64393114

>>64393090
Like, inside of a single building? Sure. I don't think many businesses are privately laying down their own global wires to connect all their facilities around the planet, although they can probably lease something like that from tier 1 ISPs or use satellites or something. But the difference is that Google's content network isn't for secure in-house networking, it's for directly providing their services to end-users.

>> No.64393251
File: 453 KB, 1280x720, 1501948381523.jpg [View same] [iqdb] [saucenao] [google] [report]
64393251

Unix signals were a mistake.
Reading synchronized events from a file descriptor is the way to go.

>Don't have to deal with interrupt-safe function bullshit
>Don't have to deal with EINTR bullshit
>Don't have to complicate the kernel implementation and deal with obscure race conditions
>Thread safe
>More flexible
>You (the application) gets to decide when to process events, and in what thread.
>Can support more than just the common unix signals, but all kinds of user-provided callbacks like for asynchronous IO or whatever

I'm not seeing any reason at all to support unix signals in my kernel, and I don't care about compatibility.

>> No.64393281

>>64393251
>Cniles bitch about exceptions in other language
>Have the same thing unavoidably built into the OS

>> No.64393307

>>64393281
Signals are closer to interrupts than exceptions, and they don't work the same way.
And just because Intel calls interrupts 0 to 31 """exceptions""" doesn't mean they're actually exceptions, they're still just normal interrupts/traps/faults.

>> No.64393352

>>64393251
This, plus the idea of killing a process by sending it a signal it can't process is retarded, just like calling the syscall to send signals "kill".

>> No.64393381

>>64393352
What do you propose as alternatives?

>> No.64393427

>>64393381
https://msdn.microsoft.com/en-us/library/windows/desktop/ms686714(v=vs.85).aspx
There's no reason for async IPC and process termination to be combined in any way.

>> No.64393507

Should I learn C++? I know C and Python only and I need something more work-oriented.

>> No.64393525

>>64393507
>work-oriented
Java

>> No.64393560

>>64393507
What >>64393525 said. Java will make you want to die but it's also simple and in demand. Maybe learn C++ afterwards.

>> No.64393582

>>64393507
it's a hell of a rabbit hole and it takes a long time to learn it well (and if you don't plan to learn it well, don't bother). but if you stick with it, you won't regret it (i don't, and i've never met anybody who does). not to mention the kind of jobs you'd qualify for with C++ proficiency under your belt are a lot more fun. it's worth the investment

>>64393525
Java jobs are mind-numbing. unless you have a passion for writing shitty apps nobody will ever use for smart TVs or some shit

>> No.64393588

>>64393507
C#

>> No.64393618

>>64383927
Writing your own simple compiler is pretty easy.
If you start with forth, getting a basic operating system up and running should be easier then almost any other system

>> No.64393622

>>64393582
Life is too short to learn C++ well. The only thing you'll gain from investing that time is a longing for a language that can do as much as C++ can as efficiently as C++ can without being so backward.

>> No.64393638

Is a move in Rust always a memcpy? How does Rust handle back pointers?

>> No.64393640

>>64383927
>share a similarly ambitious dream if you have one.
One day I will stop building my own toy CPUs, operating systems and compilers and do something actually useful, like a CRUD app.

>> No.64393655

>>64393582
>C++
>if you stick with it, you won't regret it (i don't, and i've never met anybody who does)
It's a well-known fact that long-term exposure to C++ induces brain damage and a Stockholm Syndrome-like condition. I've never met anyone competent who wasn't revolted by C++.

>> No.64393660

>>64383927
Nice, I have (had) the exact same dream.
Except I gave up on the compiler part. I've made a few simple things in logisim, and the most I've done is a very simple CPU.
I've designed my own ISA/platform implemented in virtual machines though, and I'm currently writing an OS that runs on x86 CPUs.

>> No.64393695

>>64393638
>Is a move in Rust always a memcpy?
Yes.
>How does Rust handle back pointers?
Regular back pointers(i.e. references) are impossible to construct in safe rust, but you can use Rc/Weak for it. Also see http://cglab.ca/~abeinges/blah/too-many-lists/book/ .

>> No.64393740

>C's advantage is its strict type system but still allow some flexibilibity with casting
>C++ have C's advantage, and adding OO, and generic support
Then why the fuck they allow confusing stuff like auto??

>> No.64393764

>>64393740
>being confused by this
>thinking it makes the type system less "strict"
auto x = 123;

>> No.64393771

>>64393740
>C has a useful type system
>C has a stricter type system than C++

>> No.64393811
File: 425 KB, 600x481, what.png [View same] [iqdb] [saucenao] [google] [report]
64393811

>>64393740
>C's advantage is its strict type system
what

>> No.64393817

>C++ is a programming language
>C++ is useful
>there exists a valid justification for the creation of C++

>> No.64393822

>>64393817
>C++ exists

>> No.64393827

>>64393811
I guess it's strict relative to its predecessors (B/BCPL) and plain assembly...

>> No.64393854

>>64393817
I'll take all three

>> No.64393865

>>64393827
>strict relative to plain assembly
and a tent is great compared to sleeping in the rain but it ain't no fucking hotel room boyo

>> No.64393867

>>64393817
C++ isn't a programming language, it's at least 5 or 6.

>> No.64393930

>>64393865
>being too dumb to understand the actual point
One could very well say that one of the advantages of C over its predecessors was a strict type system (relatively speaking), and that C++ negates this advantage by having a less strict type system, except that `auto` doesn't make the C++ type system less strict, which is the real problem with his post. If you want to talk about strictness in some absolute sense, "strict" type systems don't exist in any mainstream programming language.

>> No.64393932
File: 75 KB, 930x485, Screen Shot 2018-01-20 at 22.10.29.png [View same] [iqdb] [saucenao] [google] [report]
64393932

Can anyone tell me wtf is going on here?

https://gist.github.com/eskriett/6038468

>> No.64393944

>>64393854
>I'll take all three
Maybe you could take them with some future version of C++. I'm sure they'll get it right in C++ 4x.

>> No.64393948

>>64393930
oh sorry friend I didn't realise you were comparing C and C++ in the context of 1985 silly me

>> No.64393953

>>64393944
they already got it right with C++11

>> No.64393960

>>64393932
It generates an X,Y tile coordinate based on the latitude, longitude and zoom level. First it uses a left shift to get the power of 2. Then it finds the x point given the longitude. Then it converts the latitude to radians and takes the sine. Then it calculates the y coordinate and returns the result. It's so easy when you know how to read!

>> No.64393964

>>64393953
You mean C++14 at least.

>> No.64393970

>>64393948
>being too fucking dumb to actually understand the point even after having it explicitly spelled out
You never cease to amaze me, /dpt/.

>> No.64393979

>>64393960
nice joke but what are those formulas?

>> No.64393981

>>64393953
>they already got it right with C++11
You have a very low standard for C++.

>> No.64393990

>>64393981
C++fags have low standards.

>> No.64394011

>>64393964
C++14 additions were little more than syntax sugar. The most noteworthy changes were function return type deduction and less shit constexpr functions.

>> No.64394012

>>64393990
all fags have low standards that's why they sin against God

>> No.64394020

>>64393970
are you disabled?
>one of the advantages of C over its predecessors
literally nobody considers C in terms of the advantages over its predecessors any more
people haven't even heard of the predecessors these days
so when you say "C's advantage is its strict type system" because "BCPL was less strict" you're the retard not me

>> No.64394064

>>64394020
How do people like you manage to survive long enough to reach the ripe age of 12 is beyond me. Don't you have some socket to lick?

>> No.64394079

>>64393588
this, if you're apprehensive about committing to C++. C# is much better than Java and it's recently spiked in popularity in the private sector

>>64393622
>Life is too short to learn C++ well
haha, i'd be lying if i said i don't still learn something new about it most days. but you can be a very effective programmer while still falling short of total mastery

>The only thing you'll gain from investing that time is a longing for a language that can do as much as C++ can as efficiently as C++ can without being so backward
there's definitely some things i'd do differently if i had my way, but it's far from "backward" (and it gets considerably better with each standard revision). it's easy enough to imagine something more ideal; there's always room for improvement. but what C++ has going for it is that it isn't a fantasy. that and, as i mentioned, the kind of work that's done using C++ is usually much more interesting/engaging, which is well more than enough to make up for language gripes

>>64393655
>It's a well-known fact that long-term exposure to C++ induces brain damage and a Stockholm Syndrome-like condition
what gives this apparent effect is that when you actually learn C++, most of the things you used to think were stupid about it turn out to have good reasons for being the way they are in the context of the language. admittedly not all, but most

>I've never met anyone competent who wasn't revolted by C++
any autist can argue syntactic and semantic ideals until the end of time, and nobody is more aware of the flaws of C++ than the people who actually know and use it. but they tend to find that they're a small price to pay, all things considered, and that solving real problems in interesting and efficient ways is generally more fun than sitting around bitching about what could be better

>> No.64394128

>>64394064
okay two things
you're a retard for implying anyone uses C for its "strict type system"
you're an immature retard at that for resorting to flinging shit like a monkey when people tell you you're wrong

>> No.64394134

>>64394079
>most of the things you used to think were stupid about it turn out to have good reasons for being the way they are in the context of the language
>"good reasons"
>in the context of the language
What you mean by that, of course, is that every badly designed misfeature of C++ is the lesser of multiple evils given all the previous design errors, which you've come to accept over time, because you can no longer imagine a language with solid foundations. Thanks for illustrating exactly what I'm talking about when I talk about your Stockholm Syndrome.

>nobody is more aware of the flaws of C++ than the people who actually know and use it
The only C++ "programmers" who are aware enough use it as a glorified C and avoid the vast majority of its features.

>they tend to find that they're a small price to pay, all things considered, and that solving real problems in interesting and efficient ways is generally more fun than sitting around bitching about what could be better
Every user of every piece of trash language says this.

>> No.64394137

>>64394079
>most of the things you used to think were stupid about it turn out to have good reasons for being the way they are in the context of the language.
the ones that do have a reason to be there are there because of being trapped by backwards compatibility, but there are many that could easily have been implemented as well as they were within the same constraints. e.g. move semantics.

>> No.64394147

>>64388795
RUNNING IN THE 90'S

>> No.64394153

>>64394128
>you're a retard for implying anyone uses C for its "strict type system"
Quote where I was implying it, cripple.

>when people tell you you're wrong
Repeatedly failing to grasp a simple point and screeching "nuh-uh!" in response is not an argument, you ball of broken chromosomes.

>> No.64394165

>>64394153
>Quote where I was implying it, cripple.
ok
>C's advantage is its strict type system

I'm gonna stop talking to you now so enjoy your last laugh you retarded monkey

>> No.64394197

>>64394165
>he quotes a completely different poster
>after responding to a post of mine that refers to said poster as a third party and criticizes him
Please, don't reproduce.

>> No.64394209

>>64393114
Google has the $ to lay down their own fiber and shit, yeah. Mostly because they're actually in the business of it and it's profitable, though most of this is residential. But it's not out of the ordinary for other companies with important non-internal traffic to grab some dark fiber from, say, Level 3 or Zayo, either kick up a few joint COLOs with the boys i.e. Netflix w/ Zayo, or establish your own POP instead (eh, not ideal in most cases.)

Basically, any pretty large business that doesn't cuck its network engineering team will end up going down a somewhat similar path if the funds and infrastructure are available, and if the data they stream to clients/customers is fragile and important enough.

>> No.64394335

How do you make a function overload in seppels that accept lamda object?
void shit(Foo& a, Foo& b); //accept 2 Foo
void shit(Foo& a, Bar& b); //accept a Foo and a Bar
template<typename F>
void shit(Foo& a, F& b);// accept a Foo and a lamda orfunction object or function pointer

>> No.64394355

>>64394335
std::function

>> No.64394375

>>64394335
The last one if you're calling it immediately, or use a std::function if you need to store it persistently and can't use templates.

>> No.64394382

>>64394335
template

>> No.64394443

Will SCIP really help me if I bother to read it fully?

>> No.64394449

>>64394443
yes

>> No.64394461

>>64394209
I think Google does it because their bandwidth costs would be insane if they were paying tier 1 ISPs.

>> No.64394467

New thread:

>>64394456
>>64394456
>>64394456

>> No.64394473

>>64393932
Stupid to create a class for this tho. Fucking javafag. As for the rest it's not really clear what units are being used in the latitude and longitude values. I assume degrees as floating points (3.55 means 3° 30' 30") but idk. Then once you determine that it's just basic spherical geometry.

>> No.64394554

>>64394375
I need all three function. The problem with using template only is if I pass a derivate object from either Foo or Bar, then the templated function gets called as function object and causing problem.
Also what do you mean by persistently?

>> No.64394563

>>64394554
Do they have to be overloads?

>> No.64394575

>>64394563
Unfortunately yes

>> No.64394609

>>64394575
You could avoid templates and take a std::function parameter. That has a performance cost and requires dynamic allocation however.
Failing that, you could do some metaprogramming crap to determine if F is supposed to be a Bar or a callable. If you're using C++17 you can use if constexpr, otherwise it'll be messy.
If that's too complicated, the simplest way to resolve the overload is to add an explicit disambiguator.
struct CallableTag {} callable_tag;

template <typename F>
void shit(Foo &a, F &b, CallableTag);

shit(Foo{}, [](){}, callable_tag);

>> No.64394675

>>64394609
Yea that is actually my temporary "fix" for the function overload. By having a third dummy int argument to differentiate the function. But it feel really hackish and makes the documentation more complex. Probably I need to chamge it to std::function. Thx for the help anon

>> No.64394704

>>64394675
If you create a named type for the overload like that CallableTag, it should be clearer what you mean.
It's a common pattern in the standard library to use the types in the argument list to select different behaviour when overloading is necessary (e.g. with constructor calls). Other sepplesfags will understand what is happening here.
But if cleanliness of interface is most important, performance is not, and you really can't give the function another name; use std::function.

>> No.64395138

>>64387338
He later helped develop javascript.

>>
Name (leave empty)
Comment (leave empty)
Name
E-mail
Subject
Comment
Password [?]Password used for file deletion.
Captcha
Action