What are you working on, Sup Forums?
Previous thread:
What are you working on, Sup Forums?
Previous thread:
Other urls found in this thread:
stackoverflow.com
wiki.dlang.org
twitter.com
dumb muslim poster
that's a feather, user
you mean dumb kiwi poster
Really stupid question: if I've overloaded operator(const MyClass& other) {
return other < *this;
}
Specifically, will "*this" do what I expect it to? Is there anything I should watch out for?
It will do what you expect it to.
I should add, in C++
why the fuck would you do that in the first place
Not him but what happens if you do
bool operator *this;
}
bool operator>(const MyClass& other) {
return other < *this;
}
Does the compiler hang?
I assume you mean to write
bool operator>(const MyClass& other) {
return !(other < *this);
}
But this is misleading unless there's no way two of these objects can be equal, you should consider that case too.
It's infinite recursion and stack overflow. No difference to this.
void foo()
{
bar();
}
void bar()
{
foo();
}
>I assume you mean to write
No he had it right.
(a > b) ==> (b < a)
I agree with this completely but I generally don't make it this explicit for myself. I call things 'bad code' without any sensible reasons if I wrote it in a bad mood.
I'm sure there's instances where if I waited a year and looked at it again I'd be fine with it.
I find it difficult to see how a programmer could not feel this way about pieces of code you've written. Maybe all you feel is insecurity or hubris.
I'm a C/Python/C++ and asm programmer mostly.
Oh shit, right.
Just started learning C.
>The char *gets(char *s) function reads a line from stdin into the buffer pointed
What does stdin mean? I know it's a stream data, but this wasn't really clear to me.
Does it only mean it's what you type on keyboard?
It's everything you type into the console when your program is running in it.
Search for the /gd/ font share site
>will *this do what I expect it to do
Isn't 'this' the lhs in the operator call in C++?
I'd never want to use something that arbitrarily reverts the ordering through overloading a comparison operator.
Maybe you should have expanded with a more silly example to get your point across (like adding a random number to each of the sides and then compare)? Sometimes more code can let people nail down what you were asking better.
standard input, normally it's what what you type into the terminal but it can also be other data that's been piped in
Thanks.
Another thing:
how do you read "*gets(char *s)"
Is it a funcion where you input a pointer?
What difference is there between stdin and scanf?
Yes. Doing *s will yield a char. Doing *gets(s) will yield a char.
scanf is a function, you use it to read data in a certain format from stdin
tweeting any nonsense gets her likes
It's what you type into the console or any input directed at your program through stdin.
Examples:
stackoverflow.com
This also inputs to stdin.
Gets is a 'blocking call' meaning it will stay at that call until you send it input. That's why you get an opportunity to type in the information instead of the program just checking if there's something there and continuing on.
>I'd never want to use something that arbitrarily reverts the ordering through overloading a comparison operator.
Why the fuck not? (a > b) ==> (b < a) in logic. Do you want that to not be true?
Yeah "this" is the LHS, so if I have the '>' operator defined, and I want to define '
mb. I misread.
It's confusing me a bit, because I read it as pointer s, the size of char.
Is this it?
Cool, thanks.
char *x;
You should read a declaration like this as "Dereferencing x will give me a char"
anyone else amazed by how you can just type javascript code into browsers and it just works?
Or more commonly put as "pointer to char".
Not really.
python and lua both do that
Don't see how that's all that relevant. Unless you're calling this nonsense, which I don't agree on.
Ok, this makes much more sense.
I've always read it as "allocating memory space for a char"
No I'm not all that amazed that there's interpreted languages.
I'm more impressed when programs hotload assets like dlls. That's neat.
Don't confuse allocation with getting a pointer. You can get pointers to things which are already allocated.
char c;
char *ptr_to_c;
c = &c;
Then perhaps it's worth to add that what you get after this declaration a pointer that doesn't point to a char you want it to point to (unless you initialized it). You'd have to allocate it or assign it a char to point to before you dereference.
char c;
char *ptr_to_c;
ptr_to_c = &c;
Sorry.
But in this case it shouldn't be ptr_to_c=&c ?
Gosh I'm so confused
I want to be working in D but the apparent lack of debugging options in D blows huge D. No wonder this language isn't treated seriously.
text based 3d engine.
>but the apparent lack of debugging options in D
umotm8
wiki.dlang.org
So essentially an ASCII renderer for 3D objects?
why can't you use gdb or something liek it?
I need a local database for an application I'm developing, but it must support multithreading (so no SQLite).
The DB must be local, or at least self contained (in the sense that if I distribute the application it will just werk).
I'm going to insert ~50k entries, so doing it in a single thread will take for ever.
What's the recommendation?
a 3d engine is also an animator, lightning manager, collision calculator etc
Of course, but I was asking about the "text" part.
package require Tcl 8.6
proc gen {} {
yield [info coroutine]
for {set i 0} true {incr i} {
yield $i
}
}
proc replace {source factor result} {
yield [info coroutine]
while true {
set x [$source]
yield [expr {
[string is integer $x] && $x % $factor == 0 ? $result : $x
}]
}
}
coroutine numbers gen
numbers ;# drop zero
coroutine filter1 replace numbers 15 fizzbuzz
coroutine filter2 replace filter1 3 fizz
coroutine filter3 replace filter2 5 buzz
puts [join [lmap _ [lrepeat 100 whatever] filter3]]
and my response was relevant to that. this renders 3d objects to ascii, lets you change the camera position on them, apply lightning, animate the objects etc
Yes, so the renderer.
What's the deal with the notation for declaring a pointer (let's say a pointer to an int) as seen in K&R?
int *ip;
It seems to make more sense if it were int* ip.
cause int *a, b
"Declaration follows usage"
Doing * to ip results in an int.
In the same way:
int arr[5];
arr[2] // is an int
>multithreading (so no SQLite).
you can still use it with a little extra work
renderers dont animate or detect collision
the convention seems to be
int *ip
at least in OSS code. i'd stick to that if i was you
int *ip; int * ip; int* ip;
Are all identical. It's just style. But the middle is objectively superior to the other two.
Likewise
const int is identical to int const but the second is objectively superior, especially when you start throwing pointers into the mix.
Cheers.
>renderers dont animate or detect collision
Neither they have anything to do with the text part.
in the SICP why does
(((double (double double)) inc) 5)
equal 5?
maybe i'm not cut out for scheme
*equal 21
fug, my bad
can't even post right
What is double defined as?
Renderer will render fonts so the text is part of it.
Also what's inc defined as?
>Visual D
Garbage. I don't want anything to do with VS if I can avoid it.
>Mago
Similar to above. Still looks shitty.
>WinDbg
This kind of works. I can step through line by line but it isn't allowing me to see what variables exist and their values. Useless.
>ddbg
Looks like a dead project. Although there is a successor debugger called Ddbg which also looks to be near dead.
>OllyDbg 2
A debugger on an assembly level. Looks to suffer the same issues as WinDbg that I mentioned before though.
I'd love to use gdb. I'd shut my mouth if it would work but gdb doesn't appear to like any D compiled executable that I throw at it. I've tried to compile using DMD and LDC with different arguments and to no avail. I'm not writing some special program either. Just below:
import std.stdio;
int main(){
int num = 10;
int val = 20;
writeln("greetings globe");
return 0;
}
I'm really hoping that I'm just retarded and I'm not doing something correctly.
daily reminder that lisp is the work of the (((chosen))) ones
(define (double f)
(lambda (x) (f (f x))))
(define (inc x) (+ 1 x))
We need a languages for [[[]]], {{{}}} and .
>import std.stdio;
int main(){
int num = 10;
int val = 20;
writeln("greetings globe");
return 0;
}
speaking of garbage.
void main()
{
import std.stdio: writeln;
int num = 10;
int val = 20;
"greetings".writeln
}
Why doesnt GDB work though?
Try VSC though, it has nice debugging stuff
for the last one there's Rust
>{{{}}} and .
sepples
Do you know what (double double) evaluates to?
I think once you figure that out it will be pretty easy.
>"greetings".writeln
absolutely disgusting
Hello rustlet.
>[[[]]]
matlab
[[[]]] - see OP
{{{}}} - 2many2count
- C++
If your language uses {}, [] or it's shit language.
Common lisp does not have this problem.
young lisper reporting sir
How do you find greater/less than?
dumb shit poster
when are you starting to work on the greater israel project?
>ask a genuine on-topic question
>get called a shitposter
???
>he knows
>shutitdown.lisp
#include
top kek
Me again from last thread. Why do I get pic related warning, and how do I make it go away?
(less-than a b) dipshit.
>breaks your parantheses key
its over shlomo
you call me that gain, and you'll be in deep shit bro
I said Common Lisp doesn't have this problem.
C is shit.
ah, I see my error
for some reason I though it'd break down into 8 inc's. now I see why it'd become 16
>have to type more because you refuse to have an operator
"""""""style""""""" over substance is awful.
>my poor fingers
Just do (define < less-than)
> and < operators are different from closing tags.
dumb fuck.
what if you need to compartmentalize the result of an expression, like for ex I can do in C
(1 || 2) && (2 || 3)
do you use pharanteses too or do you just commit suicide everytime you need to break up a statement into parts?
trying to modify some ancient, spaghetti ridden embedded code, for a taxi intercom system
In lisp that's
(and (or 1 2) (or 2 3))
(and
(or 1 2)
(or 2 3))
dumb blub poster
>make a vague post
>get mad when people dont adhere to it
really says a lot desu
>have to alias an operator just to get sane functionality
awful
>this is not allowed in C++
kek
vector v;
dumb shit poster
How is it not