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

Maintenance is complete! We got more disk space.
Become a Patron!

/g/ - Technology


View post   

[ Toggle deleted replies ]
File: 62 KB, 961x416, 1509805001354.png [View same] [iqdb] [saucenao] [google] [report]
63242407 No.63242407 [Reply] [Original] [archived.moe] [rbt]

Previous thread: >>63236796
What are you working on, /g/?

>> No.63242426

>>63242407
first for my toy lang

>> No.63242458

>>63242399
Wow lad, someone taught you that 1337 haxxor trick. How will others ever recover.

>> No.63242464

>>63242458
The 1337 haxxor trick of pointing out that you're a schizo?

>> No.63242489

>>63242464
>lol ur schizo
Come on, lad. At least be creative, you are so much predictable at this point.

>> No.63242534

I'm trying to understand the rationale for the oddity of the C++ modules TS: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4681.pdf

The two primary goals of C++ modules are: to enable more efficient incremental builds by precompiling imports and avoiding the noncommutative order-dependence of #include files containing macros; and to provide a better means for separating public interfaces from private implementation details.

So, why can't this be done in a more minimal way, such as this "Modules Lite" strawman proposal here?

> Support non-interfering, precompilable headers by introducing a new "#import <header>" directive, which works just like "#include <header>" except that macros defined within the imported header are not lexically visible inside the bodies of subsequently #imported files.

>Inside a namespace or a class or struct inside a namespace, allow "exported:" and a new "internal:" access specifier to limit the visibility of subsequent symbols to the current namespace, its child namespaces, and declared friends of the current namespace.

>Allow "friend" declarations inside a namespace, exposing this namespace's "internal:" symbols to the declared friends.

>Extend "friend" declarations to support namespaces in addition to classes and structs.

Does this kind of approach fail to accomplish the goal of modules in some fundamental way? It seems like it would be more useful in separating exported symbols from internal detail at a more granular level than "everything in this class, struct, or namespace"; it would preserve most of the functionality of macros; and it would follow existing precedent more closely.

>> No.63242563
File: 29 KB, 367x384, this-problem-requires.jpg [View same] [iqdb] [saucenao] [google] [report]
63242563

>>63242489
>everyone who shits on rust is the same person!
>look, i have a proof! all posts with this anti-rust pic shit on rust! coincidence? i think not!
>the different posters pointing out the absurdity of my conclusion are also the same person!
>w-what's that? screencap implies they're different people?
>h-haha, s-someone taught you 1337 haxx
This is what mental illness looks like.

>> No.63242575

Reposting from last thread. For some reason this simple program keeps leaking memory. About 400kb a second for me. Also, when I replace join with detach it segfaults. I can't find any useful info about this and I'm beginning to think std::thread is just full of bugs.

#include<thread>

void foo(){
//literally nothing
}

int main(){

while(true){
std::thread t(foo);
t.join();
}

return 0;
}

>> No.63242594
File: 2.98 MB, 1008x720, 1504816891483.webm [View same] [iqdb] [saucenao] [google] [report]
63242594

Timely reminder that C is the language of Lain.

>> No.63242600

>>63242594
you mean lisp

>> No.63242607

>>63242563
Actually, you literally are the same person - the "mutible mutable reference" autist. Your line of "logic", your post pattern, timing, issues with Rust are so damn retarded that even it's too predictable, even for echo chambers like /g/

>> No.63242619

>>63242575
I can't reproduce this. Are you sure your program does not include a profiler, address sanitizer or such thing? The memory increase may come from this.

>> No.63242645

>>63242575
_CRTDBG_DELAY_FREE_MEM_DF may be on for some reason

>> No.63242658

>>63242631
meanwhile
auto min(X,Y)(X x, Y y)
{
auto res = (x > y) ? y : x;
return res;
}

>> No.63242668

>>63242658
>He didn't return (x > y ) ? y : x
laughing whores.jpg

>> No.63242671
File: 669 KB, 900x506, nene2.png [View same] [iqdb] [saucenao] [google] [report]
63242671

How does /dpt/ feel about Nene?

>> No.63242676

>>63242671
Shit anime

>> No.63242681

What project can I work on that would show I can handle an enterprise dev environment?

>> No.63242696

>>63242668
it's late, but yeah, even better.

>> No.63242702

>>63242681
Anything with a sprawling nonsensical architecture running in different but overly coupled contexts

>> No.63242708

>>63242671
Inspiration to us all.
She learned a difficult language in a difficult skill to be with her bff.
And she's qt.

>> No.63242714
File: 241 KB, 750x1064, 1484115234441.jpg [View same] [iqdb] [saucenao] [google] [report]
63242714

Writing a kernel in C++, just wrote a custom Tuple implementation:
namespace detail {
template <usize i, typename T = void, typename ...Ts>
struct TupleLeaf : TupleLeaf<i - 1, Ts...> {
template <typename U, typename ...Us>
constexpr TupleLeaf(U &&u, Us&& ...us) : TupleLeaf<i - 1, Ts...>(forward<Us>(us)...), value(forward<U>(u)) {}

constexpr TupleLeaf() = default;

T value;
};

template <>
struct TupleLeaf<0, void> {};

template <typename T, typename ...Ts>
struct first {
using type = T;
};
}

template <typename ...Ts>
struct Tuple : detail::TupleLeaf<sizeof...(Ts), Ts...> {
static inline constexpr usize size = sizeof...(Ts);
static_assert(size > 0);

constexpr Tuple() = default;

template <typename ...Us, typename = trait::enable_if_t<sizeof...(Us) == size>>
constexpr Tuple(Us&& ...us) : detail::TupleLeaf<size, Ts...>(forward<Us>(us)...) {}

template <usize i>
constexpr auto &get() {
static_assert(i < size, "Index out of bounds");
return get<size, i, Ts...>();
}

template <typename T = void, typename = trait::enable_if_t<size == 1, T>>
constexpr operator typename detail::first<Ts...>::type () {
return get<0>();
}

private:
template <usize len, usize i, typename U, typename ...Us>
constexpr auto &get() {
if constexpr (i == 0) {
return static_cast<detail::TupleLeaf<len, U, Us...>&>(*this).value;
}
else if constexpr (true) {
return get<len - 1, i - 1, Us...>();
}
}
};

template <typename ...Ts>
Tuple(Ts...) -> Tuple<Ts...>;

template <typename ...Ts>
struct tuple_size<Tuple<Ts...>> {
static inline constexpr usize value = sizeof...(Ts);
};

template <usize i, typename ...Ts>
struct tuple_element<i, Tuple<Ts...>> {
using type = decltype(trait::declval<Tuple<Ts...>>().template get<i>());
};


Find something wrong with it.

>> No.63242743

>>63242702
I'm not sure how to replicate that.

>> No.63242751
File: 6 KB, 200x200, my-sides.jpg [View same] [iqdb] [saucenao] [google] [report]
63242751

>>63242607
>the "mutible mutable reference" autist
It's "mutable", fucktard. And I am that poster, but most of the posts from your screenshot weren't mine, and the second poster in the other thread wasn't me either. To be frank with you, I feel a mild sense of accomplishment seeing the detrimental effect I'm having on your mental state. Look out, kid, one of those days you'll start seeing "me" back on Reddit, or maybe even standing on your porch.

>> No.63242768

Thoughts?

MODULE Summer
IMPLICIT NONE
REAL, SAVE, PRIVATE :: fred = 0.0, joe = 0.0, bill = 0.0
CONTAINS
SUBROUTINE A
IMPLICIT NONE
fred = fred+1.23
END SUBROUTINE A
SUBROUTINE B
IMPLICIT NONE
joe = fred+0.7
END SUBROUTINE B
SUBROUTINE C
IMPLICIT NONE
bill = fred+joe
END SUBROUTINE C
SUBROUTINE D
IMPLICIT NONE
PRINT *, bill
END SUBROUTINE D
END MODULE Summer

>> No.63242776
File: 28 KB, 604x338, unicode.png [View same] [iqdb] [saucenao] [google] [report]
63242776

>> No.63242777
File: 3.79 MB, 1904x4720, rbt.asia-g-Technology»Searchingforpostswiththeimagehash‘XtwEGaCBXjsPHlvNl8dU+Q==’..png [View same] [iqdb] [saucenao] [google] [report]
63242777

>>63242751
>yeah that's me, but I swear those were different people
No wonder it took you this much time to recover from that, literal fucking autist

>> No.63242778

>>63242768
What hocus pocus witchcraft is that?

>> No.63242788

No.63227800

- Programming languages if they were tea -

>C would be black tea:
without anything added to it, not very enjoyable unless you're willing to deal with the bitterness. Most agree that it's better if you add something to it.

>C++ would be C with milk:
comparatively good, but if you drink too much at once you begin to feel bloated.

>Java would be C with soymilk:
Why the fuck would you do that to black tea?

>C# is C with milk and sugar:
it's difficult to taste the black tea itself at this point, but it's much more enjoyable than plain black tea (and far more enjoyable than that soymilk abomination you tried a few years prior).

>Scheme Lisp would be matcha:
Most people don't even understand how to make it, but those who do swear by it. Some thinl that it helps facilitate reaching satori, but others think that it's quite a fuss for just a tea.

>Ruby would be Japanese green tea:
"An acceptable Lisp" according to some, although most agree that it's not quite as much of a mind changer as matcha.
Also, it comes from Japan.

>Python would be Chinese green tea:
Historically in competition with Japanese green tea, those who drink it insist that Japanese green tea is just silly, and that matcha is absolutely absurd.

>Haskell would be oolong:
Most haven't even tried it, but those who do become deeply involved with its odd lingo ("gong fu", "gaiwan", "yixing") and come out of it feeling they've truly experienced tea as it was intended to be experienced.

>Assembly:
Why are you eating those leaves raw?

>> No.63242795

>>63242778
Fortran 90. Is it really that alien to you?
Kids these days.

>> No.63242799

>>63242788
posted on /r/programming

>> No.63242806

>>63242795
it was half a joke, i just don't see it enough though.

>> No.63242810

>>63242777
>y-you can never recover b-because i keep screeching that it's all you
Literal mental illness. Either way, this isn't progressing anywhere.

>> No.63242825

>>63242775
Have fun writing 30 instances of matched(), close() and other common functions because your piece of shit cnile trash doesn't either have overloading or traits.

What a fucking retarded mongrel

>> No.63242836

>>63242810
>this isn't progressing anywhere.
It's definitely not progressing in your favour, autist

>> No.63242852

>>63242825
>being this subhuman
Still waiting for a technical reason explaining why that verbose trash is better. Protip: "b-because you may need to add another line to the case if they invent a new type of bracket one day" is patently absurd.

>> No.63242859

/* `_Bool' type must promote to `int' or `unsigned int'. */

typedef enum {

false = 0,

true = 1

} _Bool;


/* And those constants must also be available as macros. */

#define false false

#define true true

>replace true by true
can someone explain this to me?

>> No.63242887

>>63242859
I reminder confronting this exact crap in apple's cctools when I was building it on linux.

>> No.63242900

>>63242836
>It's definitely not progressing in your favour, autist
What, because every time you screech autistically at other posters that they're all secretly me, you become even more convinced of it?

>> No.63242908

>>63242859
but to answer your question: it's likely so that other files can express this like this
#ifndef true
# define true my_true
#endif

to avoid introducing multiple definitions from several sources.

>> No.63242919

>>63242852
It's not about another line, you fucking braindead cock gobbling piece of shit, it's about repeating the same function over and over again

>> No.63242925

>>63242788
imagine being that autistic

>> No.63242936

>>63242908
why not just define true as 1?
is enum better than that define _Bool as int

>> No.63242953

>>63242919
>about repeating the same function over and over again
Repeating what function, you literal subhuman? Name the specific function that you would have to write more than once.

>> No.63242973

>>63242953
closed()
close()
simplify()
item_count()

>> No.63242985

What's the point of C when C++ exists?

>> No.63242992

>>63242407
>Cross platform framework/language
>Made by Linux/OSX programmers
>Windows support is "important"
Why do 99% of these shits feel the need to not follow proper rules when it comes to Windows? They put shit in the right places for OSX but on Windows they think it's fine to pollute %userprofile% with their shitty fucking retarded file and folders that start with a . for no good reason at all. I am pretty sure Linux users wouldn't appreciate it when your program writes it shit to /C/Users/username/AppData/{Local, Roaming}/programname or to /C/Program Files/programname. It even got this far that even Microsoft itself has started writing their shit to %userprofile% because "OPEN SOURCE CROSS PLATFORM".

>> No.63242998

Is this UB if I make sure non-const get doesn't modify anything?
I don't want to write get twice.

template <usize i>
constexpr const auto &get() const {
return const_cast<Tuple*>(this)->get<i>();
}

>> No.63243002

>>63242936
int can take other values than 0 and 1, so it's some kind of compile time safeguard against invalid values. In C99 it's preferable to avoid all this and use stdbool.h.

>> No.63243003

>>63242973
>closed()
>close()
>simplify()
>item_count()
Why would you need to write any of them more than once, subhuman? You realize making bizarre and baseless statements =/= making an argument, right?

>> No.63243031

>>63243003
C(uck):
>close_braces
>close_brackets
>close_parens
>close_angle_bracket

Non subhumans:
>Brackets::close()

Fucking brainlet.

>> No.63243034
File: 36 KB, 640x370, IMG_1509827179705.jpg [View same] [iqdb] [saucenao] [google] [report]
63243034

Is inheritance the most overrated and overhyped feature in OOP?

>> No.63243046

>>63243031
>not using namespaces to simply resolve naming conflicts

>> No.63243049

>>63243034
not if you do your architecture properly>>63243034

>> No.63243060

>>63243034
Inheritance is a useful metaprogramming hack.

>> No.63243062

>>63242985
Nearly everything that exists in C++ and not C is bad

>> No.63243063

How to setup Haskell environment on Arch?
Googled and I don't find much concrete stuff, only people complaining about how annoying it is.

>> No.63243064

>>63243031
What are you on about, subhuman?
char close_bracket(char c) {
switch(c) {
case '[': return ']';
case '(': return ')';
case '{': return '}';
default: assert(!"fugg");
}
}
close_bracket(c);

>> No.63243065

>>63243034
I can see why you'd see it that way, if you were retarded.

>> No.63243081

>>63243060
>Inheritance is a useful metaprogramming hack.
Oh, hey there. Are you the "storing a function pointer in a struct is a useful FP hack" fucktard?

>> No.63243086
File: 173 KB, 800x800, 1509301676868.png [View same] [iqdb] [saucenao] [google] [report]
63243086

>>63243063
You should not be using Arch of you're so retarded you can't install ghc.

>> No.63243088

>>63243081
...no

>> No.63243093
File: 143 KB, 332x394, 1478128368324.png [View same] [iqdb] [saucenao] [google] [report]
63243093

>>63243064
>No distinction among brackets
This is how I know you never went past middle school
You know what they say, can't spell cuck without c

>> No.63243097

>>63243093
>more delusional drivel
I accept your concession.

>> No.63243102

Someone fill me in on whatever this autistic discussion is about.

>> No.63243108

>>63243097
>get BTFO twice in a row
>"m-more delusional drivel"
Cniles are very "simple minded"

>> No.63243111

>>63243102
>fill me in on whatever this autistic discussion is about
Which one of them?

>> No.63243119

I want my metaclasses in c++ already.

>> No.63243124

>>63243111
The one about brackets.
It seems to span multiple threads and seems extremely autistic.

>> No.63243128

>>63243102
Background:
You are working with ATS.
C-tard:
Don't generalize brackets for common operations
Rust tard
Generalize brackets for common operations

>> No.63243130

>>63243119
Come C++20, C++ will finally have interfaces

>> No.63243131

>>63243108
>y-you need to write 5 functions!
>i can just write Brackets::close()
>"close_bracket(foo);"
>o-okay! but can't spell cuck without a c! haha i win
The absolute state of Rust... I can't tell if all of you are schizophrenic, or if it's the same schizo over and over.

>> No.63243132

>>63243119
It's coming in C++20. So just wait 2 years.

>> No.63243141

>>63243130
>>63243132
I thought metaclasses wouldn't land before at least c++23.

>> No.63243149

>>63243128
AST*

>> No.63243155

>>63243124
>The one about brackets.
Oh, that one. Summary:
>>63242159
>>63242190
>>63242259
>>63242292
>>63242386

>> No.63243161

>>63243141
That was just some retard.

>>63243130
How will metaclasses introduce the ability to have interfaces?
I don't think it'll solve the vpointer problem, or am I wrong about that?

>> No.63243168

C major mistakes:
>preprocessor
>pointer arithmetic

>> No.63243173

>>63242776
You don't need to write 'static for consts and statics

>> No.63243176

>>63243131
Brackets::close_paren(tree)
meanwhile cnile:
close_paren(tree)
close_braces(tree)
close_angle_bracket(tree)
close_brackets(tree)
>I can't tell if all of you are schizophrenic, or if it's the same schizo over and over.
No it's just you

>> No.63243184

>>63243161
I don't actually know, I'm mainly shitposting. Probably?

>> No.63243188

>>63243168
No one ITT works with C. I can guarantee you. C is a dying language

>> No.63243191

>>63243168
array-pointer """equivalence""" is the main one

>> No.63243193

>>63243188
I am working on my game engine written in C11.

>> No.63243198

>>63243193
By working I mean getting paid, basement dweller

>> No.63243204

>>63243168
Sepplesfag here.
Nothing wrong with pointer arithmetic.
I have a right to offset my pointers, since after all, it's a basic freedom, and quite useful.
Even Rustfags have pointer arithmetic, it's just hidden away behind unsafe interfaces.
I don't know how you would even be able to do a lot of things if not for pointer arithmetic.

>> No.63243206

redpill me on unsigned ints

>> No.63243209

>>63243206
Nothing wrong with them.
Necessary for systems programming.

>> No.63243213

>>63243176
impl SquareBracket<'a, T> {
language::lexer::tokens::bracket::square::close<'a, Box<Rc<Node<T>>>(mut& box tree)
};

impl RoundBracket<'a, T> {
language::lexer::tokens::bracket::round::close<'a, Box<Rc<Node<T>>>(mut& box tree)
};

impl CurlyBracket<'a, T> {
language::lexer::tokens::bracket::curly::close<'a, Box<Rc<Node<T>>>(mut& box tree)
};

impl AngleBracket<'a, T> {
language::lexer::tokens::bracket::angle::close<'a, Box<Rc<Node<T>>>(mut& box tree)
};

Brackets::close()


Meanwhile in C:
close_bracket(c);

>> No.63243223

>>63243198
Usually you get paid for working with tools you wrote in C. So for the engine you would in the end get paid when writing Lua/Python/whatever-other-binding-lang. So you're not earning directly from the C tool, but the C tool is your core earning asset.
Like, nobody ears from nginx itself, or at least very little, but tons of sites based off nginx make tons of cash.
>>63243191
It's not. You just got confused by array pointer decay.
>>63243204
Unions and these operators (&, [], ->, *) cover 100% of portable uses.

>> No.63243225

>>63243213
close_bracket(0)
>This isn't a compile time error

>> No.63243235

>>63243161
I figured.
You can already write interfaces in c++ today. But with MetaClasses you can create an Interface metaclass so that you can write
interface SomeInterface {
void do_shit() const; // virtual = 0 is automatically applied by interface
int return_1(); // virtual = 0 is automatically applied by interface
//virtual ~SomeInterface() = 0 is automatically add by the interface
};

SomeInterface will automaticly have a virtual destructor, do_shit and return_1 are public by default and are also virtual.
If you add a private: specifier or a data member into the interface you can have the compiler throw and error because you can't have private methods or data members in an interface. That's just one of the things metaclasses will be able to do.
Herbs talk about metaclasses on cppcon 2017 was pretty nice, the paper he wrote is also a nice read.

>> No.63243244

>>63243235
>"interfaces"
>intrusive vptrs
try harder

>> No.63243245
File: 459 KB, 490x358, bizarro-world.png [View same] [iqdb] [saucenao] [google] [report]
63243245

>>63243225
>check future user input at compile time

>> No.63243250

>>63243223
>Unions and these operators (&, [], ->, *) cover 100% of portable uses.
Are you retarded?

&a[i]
= &(*(a + i))
= (a + i)
= a + i

>He doesn't know that array subscription is defined in terms of pointer arithmetic.
Brainlet, get out.

>> No.63243263

>>63243245
>no sanitization
>lul why were there a 0 in the AST let's crash the program now xddd

C programmers are really really "simple minded"

>> No.63243264

>>63243223
I understand array decay, the fact that so many people don't is evidence that the idea is flawed.

>> No.63243266

>>63243235
Yes but all of that is pointless if it doesn't address the vpointer issue.

>> No.63243270

>>63243250
Rustlets are cancerous, but you're the retard in this case. What he was trying to say is that most use cases for pointer arithmetic can be covered without providing direct access to it.

>> No.63243282

>>63243250
>Are you retarded
I'm not. I know it's syntactic sugar.
Just because it's defined in terms of pointer arithmetic it doesn't mean other kinds of pointer arithmetic should be allowed.
>inb4 <reinterpret_cast>
This workaround would mark unsafe and unportable code.

>> No.63243288

>>63243270
Except it's pointless.
Pointer arithmetic gives equivalent and much simpler code, and it's not any less safe or portable than the alternatives he proposed.

>> No.63243290

>>63243263
>thinking it's the job of a lexer helper function to validate input
Simply subhuman.

>> No.63243300

>>63243288
>Pointer arithmetic gives equivalent and much simpler code, and it's not any less safe or portable than the alternatives he proposed.
Checked array access is obviously safer than pointer arithmetic, for instance.

>> No.63243309

>>63243282
Pointer arithmetic is well defined. It's literally no less portable than array subscription, in fact it's exactly equivalent minus a dereference.

>> No.63243313

>>63243213
>quality enterprise tier code you see at work

>some /g/ brainlet's half-assed implementation of AST handling
hmmm

>> No.63243316

>>63242600
in one of the first episodes she was being taught c in school.

>> No.63243318

>>63243300
>Checked array access
Something C doesn't have.

>> No.63243322

>>63243318
C is not relevant>>63243318

>> No.63243324
File: 33 KB, 576x507, 1508258676237.jpg [View same] [iqdb] [saucenao] [google] [report]
63243324

>>63243313
>enterprise tier code you see at work
I hope you see that kind of code at work for the rest of your life when you finally get a job.

>> No.63243327

>>63243322
Stop quoting people twice, you fucking subhuman.
And what do you mean C isn't relevant? this fucking discussion is about C.

>> No.63243331

>>63243324
Thanks

>> No.63243345

>>63243318
>Something C doesn't have
Forbidding pointer arithmetic in C doesn't accomplish much alone. You can settle that with the Rust autist.

>> No.63243346

>>63243327
>>63243327
>>63243327
>>63243327
>>63243327
>>63243327
Then the discussion itself is irrelevant

>> No.63243350
File: 245 KB, 1104x1168, auvi7ijfursy.png [View same] [iqdb] [saucenao] [google] [report]
63243350

>> No.63243365

>>63243327
>you fucking subhuman
Quit copying my insults, fucking subhuman. Sepples monkeys aren't any better than crustlets.

>> No.63243367

>>63243034
Java creator said, that inheritance was a mistake. Use interfaces and composition instead.

>> No.63243377
File: 116 KB, 735x754, mul.jpg [View same] [iqdb] [saucenao] [google] [report]
63243377

>>63243350
You ain't seen nothing yet, kid.

>> No.63243380

>>63243309
>It's literally no less portable than array subscription
Only when used the same way as the "safe operators" I was talking about it use it.

Pointer arithmetic on non-arrays (including dynamically allocated arrays with *alloc) is undefined. That means this is undefined:
int x;
int y;
ptrdiff_t diff = &x - &y; // undefined behaviour

All pointer casts except (void *) to (original_t) are undefined. This makes
long y;
int *p = &y; // undefined behaviour


C does not assume linear memory model.
C does not assume that pointers are the same type in the machine.

>> No.63243381

>>63243350
>$.cookie('loggedin', 'yes', {expires: 1});

>> No.63243383
File: 116 KB, 694x801, 1499009531810.png [View same] [iqdb] [saucenao] [google] [report]
63243383

>>63243377
>>63243350

>> No.63243384

PROGRAM CubeRoot
USE double
USE Functions
IMPLICIT NONE
REAL(KIND=DP) :: target, result
INTEGER :: i, k
mainloop: DO
PRINT *, 'Type in a real number'
READ (*, *, IOSTAT=k) target
IF (k < 0) THEN
STOP
ELSE IF (k > 0) THEN
PRINT *, 'Some sort of horrible I/O error'
STOP 1
END IF
IF (target .EQ. 0.0_DP) THEN
PRINT *, 'The cube root of zero is, er, zero'
CYCLE
END IF
result = Newton(target, value, derivative)
PRINT *, result, result**3
END DO mainloop

CONTAINS

FUNCTION Newton (source, val, deriv)
REAL(KIND=DP) :: Newton
REAL(KIND=DP), INTENT(IN) :: source
INTERFACE
FUNCTION val (arg, targ)
USE double
REAL(KIND=DP) :: val, arg, targ
END FUNCTION val
FUNCTION deriv (arg)
USE double
REAL(KIND=DP) :: deriv, arg
END FUNCTION deriv
END INTERFACE
REAL(KIND=DP) :: current
REAL(KIND=DP), DIMENSION(5) :: previous
!
! This is cheating, but the hardest part of Newton-Raphson solution of
! Nth roots is getting the starting value, and doing so properly would
! merely be confusing. So use a horrible hack to get an approximation.
!
current = 1.1*CMPLX(source,KIND=KIND(0.0))**0.3
DO i = 1,5
previous(i) = 0.0_DP
END DO
loop: DO
current = current - &
val(current,source)/deriv(current)
PRINT *, current
DO i = 1,5
if (current .EQ. previous(i)) EXIT loop
END DO
DO i = 1,4
previous(i+1) = previous(i)
END DO
previous(1) = current
END DO loop
Newton = current
END FUNCTION Newton

END PROGRAM CubeRoot

>> No.63243385

>>63243367
>Can't implement traits for existing types
Java's trash tho.

>> No.63243387

>>63243350
if ("true" === "true") {
return false;
}


what the..

>> No.63243408
File: 777 KB, 1026x1302, lth2102.jpg [View same] [iqdb] [saucenao] [google] [report]
63243408

Why does /dpt/ hate Java again?

>> No.63243409

>>63243264
>ppl not understanding array decay
How they manage? Don't they have a subconscious understanding of rvalue vs lvalue, automatic storage duration and this sort of stuff? This alone drives you to guess array decay! Man the fact that there are retards doesn't mean we shouldn't build rockets just because most people don't grok them...

>> No.63243423

>>63243383
I assume this is some hack to "allocate" space at the start of the binary?

>> No.63243424

>>63243408
ArrayList<int> a;

>> No.63243434

>>63243408
>cylinder class inherits features from the circle class
You may be joking, but university students and many Pajeets actually do this.

>> No.63243437

>>63243409
Ask a C programmer whether an array is a pointer. The amount who answer in the affirmative should tell you that something has gone seriously wrong.

>> No.63243440
File: 248 KB, 808x805, c-baby.jpg [View same] [iqdb] [saucenao] [google] [report]
63243440

>no stable release for 6 years
It just isn't fucking fair.

>> No.63243445

>>63243385
Agreed

>> No.63243446
File: 2 KB, 281x107, trash.png [View same] [iqdb] [saucenao] [google] [report]
63243446

>>63243367
>Java creator said

>> No.63243457

>>63243437
Most C programmers are brainlets.
Just look at /dpt/.

>> No.63243466

>>63243380
I'm still waiting for anyone to show me a case where portable C code REQUIRES pointer arithmetic.

>> No.63243467

>>63243424
Java generics suck so badly

>> No.63243469

>Kotlin lets you add new methods to literally any class on the fly
This language is an abomination against the fucking lord holy shit.

>> No.63243471

>>63243437
>Ask a C programmer whether an array is a pointer. The amount who answer in the affirmative should tell you that something has gone seriously wrong.
Ask a Rust programmer if using raw pointers in unsafe blocks makes their programs safe. The amount who answer in the affirmative should tell you that something has been from the get-go.

>> No.63243476

>>63243469
But that's useful, you subhuman trash.

>> No.63243478
File: 177 KB, 709x821, 1502357646102.jpg [View same] [iqdb] [saucenao] [google] [report]
63243478

>>63243471

>> No.63243490

>>63243437
In rvalue context any array is nothing but a pointer to its first element, which is a valid interpretation of the sentence "an array is a pointer. your question is badly worded and doesn't prove a single thing about their mental model. Be more precise. Most of your victims wouldn't argue that you can reassign an array variable, so try that instead.

Intellectual honesty, I can never get enough of it.

>> No.63243511
File: 90 KB, 1250x490, rustdevs.png [View same] [iqdb] [saucenao] [google] [report]
63243511

What did xe mean by this?

>> No.63243538
File: 840 KB, 1058x690, faggot.png [View same] [iqdb] [saucenao] [google] [report]
63243538

Reminder.

>> No.63243539

>>63243511
holy shit
is this real?
post link pls

>> No.63243545

>>63243539
>post link pls
http://zurich.rustfest.eu/talks/

>> No.63243550

>>63243466
Still waiting.

>> No.63243552

>>63243424
and ?

>> No.63243558

What's the best (free) way to send notifications from a desktop app to an Android phone?

Notify My Android and Pushover both cost money.

>> No.63243566

>>63243552
It doesn't compile.

>> No.63243609

>>63243558
You need a service that the Android can reach and that's what costs money I guess. Maybe a Tor enclave? Overengineered, but the Tor network will route the phone to a hidden service on the desktop computer for free.

>> No.63243682

>>63243469
Another bad idea from C#.

>> No.63243712
File: 61 KB, 724x810, 1502107055168.png [View same] [iqdb] [saucenao] [google] [report]
63243712

>>63243682
>actually believing that's a bad idea

>> No.63243715

>>63243609
Addendum
"There must be a better way" they say. Maybe there are free rendez-vous services that don't require six hops through an anonymizing network somewhere on the internet, but I'm not aware of any so tor is a viable option. That would be a completely unethical use of tor's resources (please save them for the dailystormer) but it can be made to work IMHO.

>> No.63243739

>>63243682
It doesn't imply that they can tinker with the classes internal, only that they add new behaviours the author of the class didn't think of. Oh, that's right, one should use the "adapter" (anti)pattern

>> No.63243747

>>63243511


ABSOLUTE STATE OF RUSTKEKS

>> No.63243826

>>63243440
C has been abandoned in favour of C++.

>> No.63243840

>>63242407
>botNET SDK

>> No.63243848

>>63243609
>>63243715
Yeah that's the problem I'm running into. I can run it on my own server but can't seem to find anything to do it.

>> No.63243871

>>63243316
But she wrote Lisp on her little laptop. She learns C, but clearly prefers Lisp for her own stuff.

>> No.63243877
File: 344 KB, 1605x655, 1503050907210.jpg [View same] [iqdb] [saucenao] [google] [report]
63243877

>>63243826
WHAT

>> No.63243936

>>63243848
If you don't want to write an Android app from scratch, maybe try those web browser push notifications? No idea how they behave on android (or any where for that matter) but if you can set up a Web server on your server you're good to go maybe.
https://developers.google.com/web/fundamentals/push-notifications/

>> No.63243962

>>63243877
Yes, new developers are not interested in implementing vectors every time they need one.

>> No.63244012

How will your language even compete?

>> No.63244014
File: 64 KB, 600x710, 1476514331561.jpg [View same] [iqdb] [saucenao] [google] [report]
63244014

To what degree do most people follow the Python PEP guidelines? I'm watching a video about it, and while much of it makes sense, some of it seems silly. I don't understand why:

def func_01(one, two,
three, four,
five, six):
print("Hello world.")

is preferable to:
def func_01(one, two, three, four, five, six):
print("Hello world.")


The latter just seems so much more legible, and uses less lines and produces less whitespace than the autistic indenting.

>> No.63244049

>>63244014
Long lines are cancer readabilitywise, but breaking those lines is AIDS. My guidelines are:
* >100 character lines are acceptable if exceptional
* do f(
one, two,
three, four,
)
rather than the cancer you posted if it's reaaaaaaaaaaally too long.

>> No.63244053
File: 253 KB, 1920x1080, Screenshot from 2017-11-06 23-45-44.png [View same] [iqdb] [saucenao] [google] [report]
63244053

God bless function constraints

>> No.63244060

>>63244049
Forgot to indent but you get the point.

>> No.63244110

>>63244049
>Long lines are cancer readabilitywise
I think it depends on the content. I think yours may be better if it's all indented appropriately. I just don't want my experience in Python to be dominated by trying to make line indentation 100% straight and sharp.

How many items would be considered okay for a single line? 3?

>> No.63244127

>>63243962
That's what libraries are for, anon

>> No.63244133

what the fuck does this do

static void (*const extra_hashes[4])(const void *, size_t, char *) = {
hash_extra_blake, hash_extra_groestl, hash_extra_jh, hash_extra_skein
};


it's c++

>> No.63244140

>>63244133
looks like an array of function pointers

>> No.63244144

>>63244053
I don't see what's special here.

>> No.63244152

>>63244110
If a line is ~100 chars, there is too much information on it. Thumb rule. (Also supported by Raymond Hettinger) So if you busy 100chars, try to split it in smaller steps. In Python you can split any part of an expression out, so there's always a way.

>> No.63244155

>>63244133
Declares an array of four functions, the functions return void and take a void const * pointer, size_t and char* as argument. The array is immutable.

>> No.63244156

>>63244133
It's just an array containing 4 function pointers.

>> No.63244168

>>63244140
>>63244155
>>63244156
alright, thanks senpaitachi.
the (const void *, size_t, char *) was confusing but it's the parameters so it's all clear to me now

>> No.63244199

If I've done nothing but gone through some of SICP, what is a project I could start that I could put on my CV and get a programming job?

>> No.63244254

>>63244199
This negro's app: >>63243609

Do an app that opens a tor service on the computer, and an Android App that connects to it. Then use it to implement a silly 2 people chat. It shows you understand app programming and networking. The resulting system is not practical, but it doesn't have to be if it's just to show off.

>> No.63244284

>>63244133
https://cdecl.org/

>> No.63244295

>>63244284
C declaration syntax was a mistake

>> No.63244309

>>63244284
Sick burn. I still think C is based tho

>> No.63244355

>when your lecturer uses MS Word to open a source code file
Remind me why I'm in this university again

>> No.63244362

>>63244355
I hope it's at least free.

>> No.63244385
File: 807 KB, 2032x2163, 1508012653419.jpg [View same] [iqdb] [saucenao] [google] [report]
63244385

>>63244362

>> No.63244386

>>63244355
So that you can laze around and not get a job, without disappointing your parents.

>> No.63244398

>>63244386
I had a job though, I took a gap year

And my parents are disappointed anyway kek

>> No.63244564

>>63244355
Even my lecturers on the not university university(University of Applied Sciences which is not a University, what is up with English and making things sound better than they actually are anyway?) I went to used proper tools.

>> No.63244624
File: 274 KB, 1280x1805, __saber_and_saber_lily_fate_unlimited_codes_and_fate_series_drawn_by_naturalton__8de71eeab3877d337ec360f978d49e1a.jpg [View same] [iqdb] [saucenao] [google] [report]
63244624

should I keep using swing for java gui shit or switch to javafx?

>> No.63244653

>>63244624
You should post more qt's.

>> No.63244662

>>63244624
swing is discontinued?

>> No.63244714

>>63244624
javafx

>> No.63244822

>>63244564
It's this one "professor". He teaches a UML module and thinks Java is the epitome or programming language evolution.

>> No.63244850

>>63243350
>SQL injection is bad
> injections hurts
>let people free access to database.

>> No.63244900

>>63242998
What do you mean non cost get? The fact you consted the method means you can't rely on anything non const anyways, otherwise the program doesn't compile. Also Scott Meyer recommends writing the cost version first, then doing the cast for the non const one for this reason.

>> No.63244932
File: 389 KB, 1866x1483, 1484046603357.jpg [View same] [iqdb] [saucenao] [google] [report]
63244932

>muh infinite compression is impossible
>muh information theory
>muh mathematics
The expected number of occurrences of a binary substring of length n in a (pseudo)random binary string of length m is (m - n + 1)*2^(-n).
For the expected number of occurrences to be >= 1, m needs to be >= n + 2^n - 1
The substring can occur anywhere within the larger sequence, and it's equally likely to occur anywhere, so its index will be m/2 on average.
The average index m/2 = (n + 2^n - 1)/2 requires roughly n-1 bits to store, so you can index n bits using n-1 bits, saving a bit.
The expected number of occurrences of this index within the random string is still >= 1, so you can compress it into a smaller index, losing another bit.
Keep going until zero bits remain. Academia BTFO.

>> No.63245018

>>63243266
One of the main requirements for interfaces is a strong reflection system. So yeah by making sure the class that inherits from the interface has its public method declared as such you will indeed effectively have implemented interfaces without using a vptr. Now the question is how could this work well with C++'s polymorphism system to which I say no fucking clue (probably templates)

>> No.63245034

>>63245018
>requirements for interfaces
Shit, I meant for metaclasses

>> No.63245145

>>63245018
Pls dont. Seriously Sepples is nearing unparseability already, this will be the last step in this process.

Lisp is Purity

>> No.63245190

>>63245145
What? It's nothing that's not already being done (see Qt macros). This will just make it cleaner.

>> No.63245282

>>63244932
Call me back when you actually wrote a program that can compress any random string of bytes that I throw at it.

>> No.63245286

How do you build an user interface for an already existing API?

I am talking about ASP.NET.

>> No.63245313

>>63245282
Call me back when you can disprove my compression method.

>> No.63245314

>>63245286
I don't even get your question.

>> No.63245374

>>63245282
Do you have an infinitely big hard drive to fit my program on?

>> No.63245397

>>63245374
>infinitely big hard drive
>pretending to be another poster
>not even understanding the post
Why would he need an infinitely big drive for a program that simply indexes a PRNG output?

>> No.63245474

>>63243266
> vpointer issue
What do you mean by that?

>> No.63245506

>>63245474
>What do you mean by that?
He means sepples implicitly embeds vtable pointers into objects, altering their memory layout from what's implied by the class/struct definition.

>> No.63245533

>>63245506
So?

>> No.63245555

>>63245533
>So?
So it's shit.

>> No.63245584

>>63245555
Struct layout is machine dependent anyway. You can't control it down to the last byte in portable code anyway.

>> No.63245643

>>63245584
>You can't control it down to the last byte in portable code anyway
False. If you lay it out in a way that avoids struct padding, the compiler won't fuck with it.

>> No.63245751

>>63245643
a) are you sure that's a hard guarantee from the language spec?
b) how do you even know alignment requirements of the components in a portable way?

>> No.63245866

>>63245751
www.catb.org/esr/structure-packing/#_why_i_wrote_it

>> No.63245872

>>63245474
Intrusive vptrs mean dynamic polymorphism has a cost even if you don't use it. Interface implementation in Rust or Go costs nothing until you use it polymorphically. And also don't fuck with struct layout.

>> No.63245984

>>63245506
and? it's transparent to the user.

>> No.63245992

>>63245872
>Intrusive vptrs mean dynamic polymorphism has a cost even if you don't use it.
Exactly. Sepples is a fucking scam. Stroustrup keeps saying "if you don't use it, you don't pay for it" while secretly embedding 8 bytes of garbage in every instance of your supposedly cache-optimized particle struct, all because some asshole thought it would be funny to add the virtual keyword to one of your methods.

>> No.63246012

>>63245866
> Storage for the basic C datatypes on an x86 or ARM processor doesn’t normally start at arbitrary byte addresses in memory. Rather, each type
> except char has an alignment requirement; chars can start on any byte address, but 2-byte shorts must start on an even address, 4-byte ints or
> floats must start on an address divisible by 4, and 8-byte longs or doubles must start on an address divisible by 8. Signed or unsigned makes no > difference.
That just repeats my point though.
Alignment requirements are machine dependent. And you can't order your fields perfectly without knowing that.
Also, it never says anywhere that the compiler is required by C legalese to actually drop all the padding.
As far as I am concerned, I don't see why a standard compliant compiler could just insert padding for shits and giggles, as long as it meets the targets alignment requirements.

>> No.63246028

>>63245992
Sad thing is, all it would have taken for this not to be the case is for C++ to distinguish between a pointer to a statically known type and a pointer to a dynamically known type in its type system. Still wouldn't be as ergonomic as a modern language but it would at least make ABCs with no data members zero-cost to inherit and implement.

>> No.63246092

>>63246012
>The interesting news is that NTP has apparently being getting away with this for decades across a very wide span of hardware, operating systems, and compilers, including not just Unixes but under Windows variants as well. This suggests that platforms with padding rules other than self-alignment are either nonexistent or confined to such specialized niches that they’re never either NTP servers or clients.
Even if you want to continue pushing your cross-platform memery, how is it Sepple's business if I only care about supporting the 99.9% of platforms where my struct padding hacks work and improve performance?

>> No.63246108

I’m wanting to program a basic C compiler on my Raspberry Pi, but all of the tutorials seem to be for x86 and not ARM.

What’s a good resource to use to learn this for an ARM processor?

Would it just be more beneficial for me to have a basic understanding of assembly first?

>> No.63246126

>>63245872
I doubt that any sane C++ compiler puts vptrs on structs/classes that doesn't have any virtual members.
Also, you can't really do dynamic dispatch with at least some kind of cost.
You need to have some kind of way to know what kind of object (I use it in a very loose sense here) you are dealing with *at runtime* and how to call the appropriate method.
You could have run-time reflection, or pass the vptr as a hidden function argument (Haskell does this) or glue it to the object (C++ does this).
At the very least you, always pay for another indirection that wouldn't be there with static dispatch.

>> No.63246166
File: 3.54 MB, 500x600, 1498997559015.gif [View same] [iqdb] [saucenao] [google] [report]
63246166

Anyone here and good at OpenGL? I need help with a project. I think to fix it it'd take 10 minutes of someone that's good at OpenGL. Will pay £20. I'm broke.

>> No.63246175

>>63246126
>I doubt that any sane C++ compiler puts vptrs on structs/classes that doesn't have any virtual members.
They don't, but there's still no reason to store a vtable pointer in every class instance.

>At the very least you, always pay for another indirection that wouldn't be there with static dispatch.
Yes, but you'd pay this cost only when you actually use this functionality, instead of there being a fixed overhead for every object in every context.

>> No.63246222

>>63246126
>You need to have some kind of way to know what kind of object (I use it in a very loose sense here) you are dealing with *at runtime* and how to call the appropriate method
The best way to achieve that is to bundle a pointer to a dispatch table with a pointer to the object whenever you want to use it polymorphically. That way you can continue to use a bare pointer to the regular struct when it is behaving monomorphically.
Like I said, this is the Rust and Go approach. Sounds like Haskell behaves similarly from your description.

>> No.63246353
File: 7 KB, 180x180, smug-squid.jpg [View same] [iqdb] [saucenao] [google] [report]
63246353

I made a lisp with static type checking. Check-mate, funclets.

>> No.63246377

>>63246353
>not standardized
It's shit

>> No.63246388

>>63246166
What'syour problem?

>> No.63246409

>>63246108
Compilers have many stages, and a lot of them don't care about the machine you're compiling for.
If you don't need machine specific optimizations, the only part where the platform matters would be at the very end.
Also I think you definitely need to know assembly, since you'll probably want to have your compiler output assembly for an assembler. (which you could also write yourself)

>> No.63246428

>>63246353
Didn't that already exist? Or am I thinking of Scheme?

>> No.63246432
File: 1.37 MB, 430x360, 1506283441297.gif [View same] [iqdb] [saucenao] [google] [report]
63246432

>>63246388
I've got an object.
It has no lighting. I wanna give it the most basic lighting imaginable so that you can see that it's a 3D object.
I've got the rotation attached to a shader somehow, so everything that's attached to the shader moves. I wanna create some small cubes that'll rotate on the main objects chest, so it seems interconnected. It doesn't need to be actually interconnected.
Set the camera so that when I press a key, it'll rotate.

>> No.63246435

>>63246092
I never doubted that proper struct ordering makes things faster/smaller for most architectures and most compilers.
My point was that you have no guarantee as far as the language is concerned that it actually happens.
Hence, at the language level, you don't have control over every single byte of your struct, which was my original statement.
Which, I admit, is not a very useful one.

>>63246222
Yes, that's exactly what Haskell does.
Ok, now I get your point.
I'd love to know if the C++ vptr thing is just "well, every compiler just implements it that way" vs. "the standard does not leave much room for anything else".

>> No.63246445

>>63246432
Also the shaders aren't seperate or anything. The entire project is on one main.cpp file. Though I'm fine with them being as they are, just figured I'd point that out.

>> No.63246489

>>63246377
>X is not standardized
>therefore X is shit
Way to go retroactively aborting every higher-level language in existence.

>> No.63246500

>>63246428
>Didn't that already exist? Or am I thinking of Scheme?
Yeah, there are various other implementations with different type systems.

>> No.63246511

#define __IPHDR_OFFSETS "01122211244\0"
#define IPHDR_OFFSET(i) (__IPHDR_OFFSETS[i] - '0')
#define IPHDR_FIELDC 11


#define __IP6HDR_OFFSETS "011211\0"
#define IP6HDR_OFFSET(i) (__IP6HDR_OFFSETS[i] - '0')
#define IP6HDR_FIELDC 6


The first one works the other one segfaults when I use it.
Even something simple like comparison causes segfault. wtf am I doing wrong?

>> No.63246512

>>63246489
Common Lisp is standardized you fucking tool

>> No.63246514

>>63246353
typed racket

>> No.63246525

>>63246512
>Common Lisp is standardized
That's nice. Who was talking about CL?

>> No.63246527

>>63246512
and? python is not and still much more used in both the academy and the enterprise.

>> No.63246529
File: 195 KB, 510x346, 1505334655945.png [View same] [iqdb] [saucenao] [google] [report]
63246529

>>63246445
>>63246432
Like the project is really basic, but I just can't figure out those requests.

So hopefully one of you guys are free and can help me out for cash.

>> No.63246534
File: 68 KB, 804x906, archlinuxbalddude.jpg [View same] [iqdb] [saucenao] [google] [report]
63246534

>>63242407
Graphics programming n00b here, what's the best resource to get me to implement a very basic 3d engine from scratch?

>> No.63246540

>>63246527
>python is not and still much more used in both the academy and the enterprise.
>retards are using shit so that somehow means something

>> No.63246552

>>63246540
CL and Python both have their merits.

>> No.63246553

>>63246534
>what's the best resource to get me to implement a very basic 3d engine from scratch?
Oldschool software rendering or hardware accelerated brainlet-tier stuff?

>> No.63246554

>>63246432
The most basic lighting is done in the fragment shader by taking the dot product of the surface normal and the direction of the light.

So the normal should be a vertex attribute and the light vector should be a uniform.

You should move around the small objects with uniforms as well. You want to adjust a "model" matrix, or just a model vector I suppose.

http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/#the-model-view-and-projection-matrices

http://www.opengl-tutorial.org/beginners-tutorials/tutorial-8-basic-shading/#the-diffuse-part

>> No.63246562

>>63246511
on what input did it segfault and what were you trying to do with it? also the null byte at the end is redundant

>> No.63246569

>>63246552
>any language that isn't lisp having any merits whatsoever
Take that back, blublet!

>> No.63246570

>>63246553
Old school if possible, of course.

>> No.63246573

>>63244152
Doesn't the guideline suggest 79 or 81 characters max per line? I don't have a problem with characters in lines though. My only issue is that I have to learn how to make my code legible to other people with indenting that I don't think is always necessary or ideal. Maybe if it's 4+ items, but even then, I think it's not always needed to do a vertical style list.

>> No.63246580

>>63246554
I have no normals. Is there anyway you could have a look at my shit?

>> No.63246582

/dpt/-chan, daisuki~

Ask your favorite programming literate anything (IAMA).

>>63246534
this
https://www.scratchapixel.com/

>> No.63246595

if(statement)
or
if (statement)

Which one do you prefer

>> No.63246602

>>63246435
The standard doesn't leave much room. If memory serves then C++ is like C I'm that all struct pointers must be equal in size, and void pointers at least as large as that. Which would make implementing a Foo* for polymorphic Foo as a pair of pointers would instantly double the size of all regular struct pointers on top of void pointers.

What C++ needed was something like virtual Foo *ptr; for pointers that are polymorphic and Foo *ptr; can retain its monomorphic C meaning.

>> No.63246603

>>63246570
>www.ecere.com/3dbhole
>it still exists!
I don't know if it's the best one out there (probably not), but it got me started back in the day.

>> No.63246609
File: 565 KB, 975x1357, linus.jpg [View same] [iqdb] [saucenao] [google] [report]
63246609

>>63246573
Vertical-style lists are much more readable in any language, there is really no contest.
As for indentation, always remember:
>if you need more than 3 levels of indentation, you’re screwed anyway, and should fix your program
Pic related himself said this.

>> No.63246615

>>63246595
if(b)
fn();

is the only way

>> No.63246621

>>63246222
I'm that guy >>63246435.
I want to add that I think the inability to implement interfaces "after the fact" in the intrusive vtpr approach is even worse
than the invisible pointer member.
By "after the fact" I mean "implement an interface that the author of the type you implement it for does not know".
This tends to happen when you use 3rd party libs.
Working around that with stupid wrapper classes is not nice.

>> No.63246622

>>63246595
I prefer it without the parenthesis

>> No.63246625
File: 169 KB, 720x1280, ginanutshell.png [View same] [iqdb] [saucenao] [google] [report]
63246625

>>63246603
>>63246582
Gonna check them out later, thanks anons.

>> No.63246630

>>63246595
if <expr> { ... }

>> No.63246638

>>63246595
I prefer the second one, having the space makes it more readable.

>> No.63246639

>>63246609
class - method - loop - if

>> No.63246640

>>63246580
No I'm busy. You'll have to compute surface normals yourself with mr cross product then.

>>63246570
That's way harder but still too vague. Are you aiming for something like wolfenstein 3d? Or Outrun/Rad Racer?

For wolfenstein, you need the 2d case:
http://geomalgorithms.com/a06-_intersect-2.html

"cast" rays out from the camera at different angles to draw walls. Draw the wall with closest to the camera, i.e. with the smallest parameter. Make the height of the wall vary based on how large the parameter is.

Not really sure how Rad Racer works desu.

>> No.63246641

>>63246625
There's also lots of cool stuff here:
http://www.flipcode.com/archives/articles.shtml
This is putting me in a nostalgia mood.

>> No.63246654

>>63246621
It depends where you're coming from I guess. For a language with a mantra of "you don't pay for what you don't use", intrusive vptrs is tripping at the first hurdle.
Of course being able to write and implement your own interfaces for foreign types is great for reusing code efficiently.

>> No.63246686

>>63246621
Being able to implement interfaces for standard types is pretty neat:
trait Print {
fn print(&self);
}

impl<T> Print for T
where
T: std::fmt::Debug,
{
fn print(&self) {
println!("{:?}", *self);
}
}

fn main() {
1.print();
true.print();
["foo", "bar"].print();
}

>> No.63246688

>>63246602
The compiler already has to figure out which calls dispatch dynamically.
What's stopping a compliant C++ compiler from adopting Haskells strategy of plumbing the vptr there via invisible function arguments?

>> No.63246732

>>63246686
This flexibility does have a price though.
You have to deal with orphan instances one way or the other.

>> No.63246737

>>63246615
Good choice

>> No.63246748

>>63243434
Why would people think that cylinder is inherited from circle?

i would obviously think that cylinder contain circle class, since cylinder have circle,
and can easily have this function
class cylinder
{
circle cir;
int height;
public:
int volume()
{
return height * cir.area();
}
int surfaceArea()
{
return (2 * cir.area()) + (cir.perimeter() * height);
}
};

>> No.63246754

>>63246595
Just do what the surrounding code does ¯\_(ツ)_/¯

>> No.63246761

>>63246748
>Why would people think that cylinder is inherited from circle?
because its an extruded circle so in some way it is a circle

>> No.63246813
File: 106 KB, 750x653, 1468348033936.jpg [View same] [iqdb] [saucenao] [google] [report]
63246813

>>63242407
Whats a good project for my portfolio that shows some basic data analysis?

My current Idea is to download a bunch of craiglist posts and produce some insights around them using their tags.

Keep in mind I am not going for programing jobs. more just general analysis anything from FBI intelligence agent to BI for one of these giant firms.

>> No.63246837

>>63246562
Turns out it was unrelated. I forgot to declare some shit I passed to the function which ran that code like I did with that IPv4 stuff before.

Thanks for serving as my rubber duck again, 4chan. Don't ever copypaste your code just because it works somewhere else in your program.

>> No.63246864
File: 688 KB, 500x372, x.gif [View same] [iqdb] [saucenao] [google] [report]
63246864

>>63246166
I'm still here if anyone's free and wants to help me for some cash.

>> No.63246865

Can you help me optimizing it?

from itertools import product


def probability(dice_number, sides, target):
counter=0
pomocnicza=[]


for p in product(list(range(1,sides+1)), repeat=dice_number):
pomocnicza.append(p)
pomocnicza= [x for x in pomocnicza if sum(x) == target]

counter=len(pomocnicza)

#my_list = [x for x in my_list if x.attribute == value]



return round(counter * 1.0 / (sides ** dice_number), 4)







if __name__ == '__main__':
#These are only used for self-checking and are not necessary for auto-testing
def almost_equal(checked, correct, significant_digits=4):
precision = 0.1 ** significant_digits
return correct - precision < checked < correct + precision

#assert(almost_equal(probability(2, 6, 3), 0.0556)), "Basic example"
#assert(almost_equal(probability(2, 6, 4), 0.0833)), "More points"
#assert(almost_equal(probability(2, 6, 7), 0.1667)), "Maximum for two 6-sided dice"
#assert(almost_equal(probability(2, 3, 5), 0.2222)), "Small dice"
#assert(almost_equal(probability(2, 3, 7), 0.0000)), "Never!"
#assert(almost_equal(probability(3, 6, 7), 0.0694)), "Three dice"
assert(almost_equal(probability(10, 10, 50), 0.0375)), "Many dice, many sides"

>> No.63246874

>>63244624
>do you want to have fun?
javafx
>do you want to be employed?
swing
>do you want to be employed and still be relevant later on?
make a front end web app with jsp instead, or something

>> No.63246879

>>63246761
But at the same time, cylinder is only a stack of N amount of circle,
with N is almost infinite.

>> No.63246901

Needing a little help here. How do I normalize/add lighting?

(I understand this is a hot-mess.)
Part 1
const char *vertexShaderSource = "#version 420\n"
"layout (location = 0) in vec3 aPos;\n"
"uniform mat4 transform;\n"
"void main(){\n"
" gl_Position = vec4(aPos, 1.0);\n"
" gl_Position = transform * vec4(aPos, 1.0f);\n"
"}\0";

const char *fragmentShaderSource = "#version 420\n"
"out vec4 FragColor;\n"
"uniform vec4 ourColor;\n"
"void main(){\n"
" FragColor = ourColor;\n"
"}\n\0";

// Vertex
// =============================================================================================================
int vertexShader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);
glCompileShader(vertexShader);

// Fragment
// =============================================================================================================
int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);
glCompileShader(fragmentShader);

int shaderProgram = glCreateProgram();
glAttachShader(shaderProgram, vertexShader);
glAttachShader(shaderProgram, fragmentShader);
glLinkProgram(shaderProgram);

>> No.63246927

>>63246901
Part 2

// VBO (Vertex Buffer Object) & VAO (Vertex Array Object)
unsigned int VBO, VAO;
glGenVertexArrays(1, &VAO);
glGenBuffers(1, &VBO);

// Bind the VAO, then bind the VBO, then configure to the vertices.
glBindVertexArray(VAO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

// EBO (Element Buffer Object)
unsigned int EBO;
glGenBuffers(1, &EBO);

//Bind the EBO, then configure to the indices.
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);

glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)0);
glEnableVertexAttribArray(0);

while (!glfwWindowShouldClose(window))
{

// Input
processInput(window);

// Creating the identity matrix
glm::mat4 Trans;
Trans = glm::translate(Trans, glm::vec3(0.0f, 0.0f, 0.0f)); // Storing the identity matrix
Trans = glm::rotate(Trans, (float)glfwGetTime(), glm::vec3(0.0f, 1.0f, 0.0f)); // Rotating via that identity matrix.

// Render
glEnable(GL_DEPTH_TEST);
glClearColor(0.5f, 0.2f, 0.9f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

>> No.63246946

fuck opengl, though

>> No.63246964
File: 290 KB, 1012x1324, 1509821869833.jpg [View same] [iqdb] [saucenao] [google] [report]
63246964

>>63246946
I feel it.

>> No.63247021

>>63246748
>i would obviously think that cylinder contain circle class, since cylinder have circle
What the actual fuck? Conceptually, a cylinder is not just a specialized type of circle. It's a completely shape type. Passing cylinders to functions that expect circles almost never makes sense semantically, even if it "works" thanks to inheritance. As for embedding a circle in your cylinder so that you could use its area/perimeter methods for "convenience"; it just illustrates the idiocy of using objects and methods where functions are more appropriate:
float circle_area(float rad) {
return M_PI * rad * rad;
}

float circle_perimeter(float rad) {
return 2 * M_PI * rad;
}

class cylinder
{
float rad, height;
public:
int volume()
{
return height * circle_area(rad);
}
int surfaceArea()
{
return (2 * circle_area(rad)) + (circle_perimeter(rad) * height);
}
};

>> No.63247031

Web browser is not platform to run software on.
I don't understand why none of the big companies haven't done anything to address this, well windows 10 added software store but that's only for windows and it's add ridden shit so I doubt people even want to use it.
The big problems are
1) Installing software, nobody want to do it
2) Portable software, even if you can compile your program to multiple platforms you still have the problem that there is no GUI library that looks native on each platform.
3) The shitty attempts at making cross platform framework lock you into using one shitty language and bloated shitty build tools.

>> No.63247037

>>63246761
>because its an extruded circle so in some way it is a circle
An "extruded circle" is not a circle. Only the cross-section is a circle. A cylinder is not interchangeable with a circle semantically.

>> No.63247111

I'm writing an emulator and need to figure out this Carry Bit Flag. I understand how the logic works for addition, but if you do something like

0x00 - 0x01 = 0xFF

for an 8 Bit processor, the carry bit is set to one. I can detect carry out by simply adding the numbers to gether into a short and checking if the number is greater than 0xFF, but how do I check for carry IN?

>> No.63247154

>>63247111
>have variable that hold carry bit
>check if carry
what's so hard about it

>> No.63247157

>>63247111
uint8_t sub(uint8_t a, uint8_t b) {
int c = a - b;
set_carry(c < 0);
return c & 0xFF;
}

>> No.63247167

I'm following a Fortran tutorial about basic file I/O.
Is it considered a bad practice to define integer constants at the beginning of the program for the unit numbers of the files that you need to access? That way the user would not need to remember the unit numbers. Example:

INTEGER, PARAMETER :: unit_in = 10
INTEGER, PARAMETER :: unit_out = 11

OPEN (UNIT=unit_in, FILE='data.txt')
READ (UNIT=unit_in, FMT='(1x, f4.1)') data1(i), data2(i)
WRITE (UNIT=unit_out, FMT='(1x, f4.1)') outputdata(i)
CLOSE (UNIT=unit_out)

>> No.63247204

I can't find good example on the net.

in Java, I have
java.awt.Color color;

in my main class.
Then I have
public java.awt.Color getColor(){
return newColor;
}


How do I set color = newColor from getColor() method from another class?

>> No.63247214

>>63246813
Write a scanbot for twitter or Facebook to check for various language structures and common use words. Lots of great information there.

If you're into shenanigans, there's a game called Event[0] that has a wonderful chatbot representation, Mark Brown's Gamemaker's Toolkit on Youtube does a great series on how a common chatbot parses information and some neat things they did that really upped the ante.

To tie these two points together, a great project would be, "How many people are asking the same question in different ways?" or "What is the most common announcement right now." That kind of information would be very useful for groups ranging from PR firms to feds.

>> No.63247244

>>63247154
How do you check if carry

>> No.63247249

>>63246580
Refactor some in. you're gonna need it sooner than later.

>> No.63247260

>>63247204
public void setColor(Color newColor) {
color = newColor;
}

>> No.63247300

>>63247244
u8 a, b, c, carry;
c = a + b;
carry = c < a || c < b;

>> No.63247351

Every few months I pop into /dpt/ and the same shit is discussed constantly, will the C meme ever die in this thread? More Lua/Rust etc. less C/C++.

>> No.63247375

>>63247351
>>>/lgbt/
>>>/reddit/
>>>/anywherebuthere/

>> No.63247419

>>63247351
>will the C meme ever die in this thread?
No.

>will the C meme ever die
When someone comes up with a decent replacement.

>What about Rus-
Nope.

>> No.63247455

>>63247351
List 3 bad things about C that are objectively bad and not just "my preferred language does this differently".

>> No.63247466

>>63247351
As long as uni students exist to jerk off C, we will never stop talking about it

>> No.63247483

I'm really struggling with learning arrays in C++

And it's seemingly impossible to find any decent guides or videos online.
Does anyone know of anything that goes step-by-step through arrays and vectors?

More specifically:
I've got a project right now I'm trying to figure out, which requires using a modular function to pass names into an array that is outside the function. So for example I call a getName() function, it asks me to enter names, I enter names until I type 'quit', and the array outside that function is filled up with those names and resizes itself dynamically.

I don't even fucking know where to begin. We went from "here's how to do a for loop" to "create a modular program with a menu, arrays, pointers, binary search and bubble sort" in a single week, and I've only figured out the menu.

>> No.63247485

>>63247466
>As long as uni students exist to jerk off C
Hold on a second, anon. If the uni students are jerking off to C, and the industry mostly uses C and C++, there who are all these lovely social justice people jerking off to Rust?

>> No.63247494

>>63247485
people from Women's studies

>> No.63247495

>>63247485
>and the industry mostly uses C and C++
Get back to studying anon, you need to get good grades on those exams

>> No.63247539

>>63242985
>what is an abi

>> No.63247556

>>63246580
Calculate face normals as cross-product of triangle's edges.
Or if you just need to see some color variation on your 3d objects, compute color procedurally in your fragment shader from your positions. For example:
#version 420

in vec3 fragPos

float checker(vec2 pos, float repeats)
{
float cx = floor(repeats * pos.x);
float cy = floor(repeats * pos.y);
float result = mod(cx + cy, 2.0);

return sign(result);
}

out vec4 fragColor; //pass your position from the vertex shader

void main()
{
float n = mix(0.0f, 1.0f, checker(fragPos.xy, 16.0f));
color = vec3(n);
}

>> No.63247582

>>63247556
Fuck, it should've been
in vec3 fragPos; //pass your position from the vertex shader

>> No.63247621

>>63247495
>immediate spergouts ensue
Oh, anon... do tell us what languages are generally used in the industry for system programming. It's not C or C++ according to you, and it's definitely not Rust, so what is it? Javascript? Python? Fortran?

>> No.63247627

Need some advice here. I am just getting started with programming and have been trying out software and web development. I have been learning SQL, Java, HTML, CSS, JavaScript, and C#. If I want to get an entry level position doing Java, or maybe a web development position, what would I need to know?

>> No.63247651

>>63247621
>industry for system programming
Almost got me, nice job silently move the goalposts. Good luck on your next exam!

>> No.63247675

>>63247651
>rustlet BTFO

>> No.63247681

>>63247675
I don't use Rust

>> No.63247721

The virgin parser combinators
The chad recursive descent

>> No.63247744

>>63247483
Ask qs

>> No.63247748

>>63247744
what's qs?

>> No.63247767

>>63247748
Questions. Describe what you know so far and determine where the holes in your knowledge are.

>> No.63247770

>>63247681
not anymore you don't ;^)

>> No.63247781
File: 38 KB, 882x448, rustshit.png [View same] [iqdb] [saucenao] [google] [report]
63247781

>>63247651
>moving the goalpost
Oh, wow. You sure got me there, Rustlet... Obviously I was talking about webshit and utility scripts when I said "the industry" (in the context of a language that markets itself as a systems programming language). Is it possible to like Rust while not being a literal subhuman?

>> No.63247796
File: 124 KB, 1024x1024, 1504355056731.jpg [View same] [iqdb] [saucenao] [google] [report]
63247796

>>63247781
>zero-cost abstractions
no such thing.

>> No.63247804

>>63247781
I have yet to mention Rust, you're the one who decided to paint me as a Rustfag

>> No.63247811

>>63247796
>Le void* faec

>> No.63247822

>>63247811
void* is unnecessary indirection though. What you do with void* can often be done more efficiently without void*

>> No.63247851

>>63247627
> what would I need to know?
How to present and advertise yourself. If you are not dumb, you can and will learn most of the technical stuff on the job.
Most of that time is spent on getting used to the idiosyncrasies of $company rather than on $framework or $language.
You have to get past the interview first. And technical knowledge is very small part of it.

>> No.63247867

>>63247822
Can you give me some concrete examples?

>> No.63247872

>>63247767
#include <iostream>
#include <string>
using namespace std;

const int COLS = 3;

// int[] is the ROW, [COLS] is self explanatory, int = # of ROWS which goes into int[]!
void displayNames(int[], [COLS], int);

void getNames(string a[], int& n);
char getMenuResponse();


void sortNames();
void findName();
void removeName();

void main()
{
cout << "NAME ARRAY - MAIN MENU" << endl << endl;

switch ( getMenuResponse() )
{
case 'A': getNames(int[], COLS, int); break;
case 'S': sortNames(); break;
case 'D': displayNames(); break;
case 'F': findName(); break;
case 'R': removeName(); break;
}
}


/* TERTIARY FUNCTIONS */
void displayNames(int[], [COLS], int)
{

}

void getNames(string[a], int& n)
{
int n = 0;
string name;

while (n )
{
cout << "Enter name: ";
cin >> name;

if ( name == "quit" )
break;

n++;
}
}


/* Main Menu */
char getMenuResponse()
{
char response;
cout << endl << "Make your selection: " << endl
<< "[A]dd Names" << endl
<< "[S]ort Names" << endl
<< "[D]isplay Names" << endl
<< "[F]ind Names" << endl
<< "[R]emove Names" << endl
<< "> ";
cin >> response;
cin.ignore(256, '\n');
return toupper(response);
}


This is what I have right now. I want to pass names from getName() to a vector array in the main function. That vector array will then be used by the sort and search functions, which I've yet to put together to do their respective jobs, but I'll worry about it once I've got the array working.

The trouble is that I can't find any kind of guide going over this. There are a few here and there about entering stuff into arrays and vectors, but nothing that covers doing it from inside a separate function, which AFAIK involves pointers and references, which I'm really flaky on understanding.

>> No.63247875

>>63247804
Perhaps, but your subhuman nature immediately exposes you for what you are. Let's go back to the post that made you start sperging out:

>>63247485
>Hold on a second, anon. If the uni students are jerking off to C, and the industry mostly uses C and C++, there who are all these lovely social justice people jerking off to Rust?
>C
>C++
>Rust
What "industry" was it likely referring to? The webshit one? Your parents should've been sterilized. The world really didn't need any more double-digit-IQ subhumans.

>> No.63247926

>>63247781
>["Hello", "Hola",
ew. spanish as the second language? you can already tell where this is going.

>> No.63247944

What interesting programming-related thing happened to you today, anon?

>> No.63247972

How to create a random integer array with min and max bounds? using for loops and random generator. .Java btw

>> No.63247991

>>63247875
Well I was never talking about systems programming or Rust, you just sperged out because you saw me insult your precious C and decided to take the conversation elsewhere. I can understand the stresses of studying can get you on edge, maybe you need to take a break and come back when you've calmed down, and then we can have a more coherent discussion.

>> No.63248031

>>63247991
>and then we can have a more coherent discussion
What can a monkey like you hold conversations about, besides his acute butthurt about C?

>> No.63248037
File: 14 KB, 540x527, catfinger.jpg [View same] [iqdb] [saucenao] [google] [report]
63248037

Sup /dpt/, I posted on here last week about an online coding screening I had to take for a possible job for this SF startup.

Well, the interviewer said he liked my code (including after a retest, when he gave it to candidates again after realizing we didn't know we could use third-party libs), and I got a remote technical interview tomorrow over Google hangouts. Says it'll consist of "meeting the team, set of technical questions and a small documentation exercise".

Is there anything I should "study" beforehand to get a good idea of what kind of questions they might ask, or any tips you might have to ace this interview? This is the quintessential dream job, and although I was an EE major in college, I've been programming for a while and am really gunning hard for this gig so I don't have to do this mediocre electronics tester job that I already have an offer for. Thanks fellow /g/ents.

>> No.63248042

>>63248031
We can talk about what classes you're taking. Anything good?

>> No.63248087

>>63248042
So basically nothing?

>> No.63248102

>>63248087
You never made it to college? Sorry to hear that

>> No.63248135

>>63248102
>i have nothing worthwhile to say, so let me just express my asshurt to you
Go get that anus stitched up, boy.

>> No.63248145

>>63247796
Iterators for example are a negative-cost abstraction.

>> No.63248152

>>63248135
Who are you quoting

>> No.63248187

>>63248152
>Who are you quoting
The combined content of your posts.

>> No.63248203

>>63248187
I don't recall saying anything like that

>> No.63248268

>>63248203
>I don't recall saying anything like that
And yet you repeat it in every post you make.

>> No.63248273

>>63242594
garbage anime
>>63243871
she's writing in asm in one episode

>> No.63248285

>>63248268
Could you point out one?

>> No.63248290
File: 9 KB, 1532x60, Untitled.png [View same] [iqdb] [saucenao] [google] [report]
63248290

I asked this a few months ago before I gave up but I'm trying to do this again. preferably I'd like to do this problem in c# because I come from a java background and am not versed very well in c or c++ or windows library/api functions for the matter.

in windows, I'm trying to get all file types open by specific programs, music playing programs to be exact. In the provided picture you'll see 2 examples the top being handle64.exe which is perfect except that it doesn't support my moonrunes and process hacker on the bottom which is a beautiful program, but still doesn't statisfy my issue programmatically.

I was wondering if anyone has experience with solving this specific problem? I haven't found very many useful solutions outside of what process hacker guy provided for me, but I can't really isolate that code to run by itself.

May or may not be helpful, this was referred to me.
https://github.com/processhacker2/processhacker/blob/master/phlib/native.c#L4066

Would appreciate some help, I tried stackoverflow but I guess my questions aren't ever good enough for them.

>> No.63248309

>>63248285
>Could you point out one?
Of course:
>>63247466
>>63247495
>>63247651
>>63247991
>>63248042
>>63248152
>>63248203
>>63248285

>> No.63248323

>>63248290
Windows locale handling and "code pages" are a joke.
Why can't they just use UTF-8 for everything, like a sensible operating system?

>> No.63248325

>>63248309
I don't see that sentence anywhere, sorry

>> No.63248335
File: 89 KB, 784x708, GmlvwmI.jpg [View same] [iqdb] [saucenao] [google] [report]
63248335

>>63242407

What's the correct approach to infinity in programming?

Started work at this new place a month now, and was chatting with my colleague there about type issues. I'm more or less fresh out of college.

As part of a task I called a function, max_users() and I naturally assumed it would only ever return an integer. It's a web application in php.

Discovered a few days later it could also potentially return a string, "Unlimited". Luckily it was only a small piece of code I was committing

We were going through the possible options, enums, -1, 0 etc. My gut instinct would have been to go with enums or 0 but I have no idea what the correct way to approach it is really.

>> No.63248336

>>63248325
They all communicate the same thing: extreme emotional distress and the presence of severe anal lacerations in the poster.

>> No.63248342

>>63248290
There's a separate API call that returns UTF-16, don't remember the name.

>> No.63248344

>>63248336
I think you're reading too deep into them and seeing things that aren't there

>> No.63248358

>>63248335
depends
in that case, 0, since you usually need 1 for admin and 0 isn't meaningful for anything else

>> No.63248406

>>63248335
>My gut instinct would have been to go with enums or 0 but I have no idea what the correct way to approach it is really.
Since you can't have static type checking anyway, you might as well use negative numbers as special return codes for stuff like this.

>> No.63248420

>>63248323
I totally agree, if I had started this project in unix or linux I'd probably be done by now. But I to create it for windows and it's an absolute pain.
>>63248342
I came across GetFinalPathNameByHandle, which would be find and dandy, but I have no idea how to go about using it. Windows documentation makes no sense to an amateur like me.

>> No.63248438

>>63248358
>in that case, 0, since you usually need 1 for admin and 0 isn't meaningful for anything else
max_users returning 0 still makes sense broadly (no users allowed). Negative numbers are more clear-cut, and are more likely to just trigger an error (e.g. trying to allocate a negative-sized array) if someone forgets to check for them instead of silently doing the wrong thing.

>> No.63248441

>>63248420
download api monitor by rohitab
apply to process hacker
???
done

>> No.63248478

>>63248344
>seeing things that aren't there
So you that puddle of blood underneath your chair is just an optical illusion? Are you sure you don't want to get that ravaged anus checked?

>> No.63248481
File: 21 KB, 601x2411, 1484495386551.png [View same] [iqdb] [saucenao] [google] [report]
63248481

>he trusted the compiler

>> No.63248488

>>63248441
So I'd extract the file path with rohitab (preferably through command-line) from process hacker, if I'm understanding correctly?That sounds convoluted as fuck and pretty hilarious. But with windows I wouldn't be surprised to going to such lengths to get a retarded file path.

>> No.63248492
File: 84 KB, 533x700, posted-it-again.jpg [View same] [iqdb] [saucenao] [google] [report]
63248492

>>63248481
Do you have any recommendations for us, anon?

>> No.63248507

>>63248488
No, use rohitab to see what API call they use

>> No.63248538

>>63248481
>generates good code unless you think you know better and do something overly complicated
I don't see a problem

>> No.63248613

>>63242788
>C
>Most agree that it's better if you add something to it.
t. brainlet

>> No.63248615

>>63242407
Porting my hobby projects to C++17, shit's cash.

>> No.63248640

>>63248481
Look at the so-called "code" "generation" for max_if_else_if_eq*

>> No.63248643

What are some good books to learn me about compilers and shit? People seem to have this really in-depth knowledge of how the C compiler and Java compilers work and I'd like to learn more about them.

>> No.63248652

>>63248640
for
>>63248538

>> No.63248661

>>63248613
Idiots giving you contradictory advice about what you should add to your tea because they didn't like it is nothing new.

>> No.63248707

>>63242788
black coffee is the patrician choice though

>> No.63248728

I want to write a webapp in C. I found nxweb, which does exactly what I want, but it isn't maintained. Should I use it anyway? With proper architecture, will it be easy to port to FastCGI or whatever later?

>> No.63248764

New thread: >>63248761

>> No.63249063

>>63248652
max_if_else_if_eq seems good to me, if neither one is bigger than the other they're gonna be equal so it's equivalent to the rest
in the case where you compute the average I agree that's one branch too many, but the reasoning was probably to put the least likely branch last and have it's target the farthest away
What assembly do you think should be generated there?

>> No.63249085

>>63249063
The same as the others, of course. It's just plain retarded. I meant max_if_else_if_eq_avg*, there are two of them and both fail miserably to optimize.

>> No.63249140

>>63249085
it can't be the same obviously since they do something different. If you wanted to be closer to the others you'd need to compares and two conditional moves, also you'd need to do the calculation everytime. With the way it is, best case you need one test and one branch, and the three branch case is rarely hit (probably)

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