What are you working on, Sup Forums?
Old thread:
What are you working on, Sup Forums?
Old thread:
Other urls found in this thread:
github.com
cplusplus.com
twitter.com
>What are you working on, Sup Forums?
loving lain
Any suggestions?
This is the custom E-Hentai client that I am working on.
Fuck, meant
Come ask any question and help if you want :)
R8 my super simplistic cout:
#![feature(specialization)]
use std::fmt::{Debug, Display};
use std::ops::Shl;
struct Cout;
struct Endl;
impl Shl for Cout {
type Output = Cout;
default fn shl(self, rhs: T) -> Cout {
print!("{:?}", rhs);
Cout
}
}
impl Shl for Cout {
fn shl(self, rhs: T) -> Cout {
print!("{}", rhs);
Cout
}
}
impl Shl for Cout {
type Output = Cout;
fn shl(self, _: Endl) -> Cout {
println!();
Cout
}
}
fn main() {
Cout
Employed Java programmer here
Looking for a decent cheap laptop for web and java dev? Maybe C as well. Any recs that aren't thinkpad?
I don't understand. Do C tards intentionally make their code ugly or is it just C?
That's pretty neat
Reposting
var truthyTetros = truthyCoords(this.active.tetromino.shape);
var truthyGrid = truthyCoords(this.grid);
var i, j;
console.log(this.active.tetromino.shape);
console.log(this.active.topLeft);
for (i = 0; i < truthyTetros.length -1; i++){
var addedPos = truthyTetros[i].add(this.active.topLeft);
if (this.grid[addedPos.row][addedPos.col] != null) {
return true;
}
}
I just want to get this collisions function done, any last tips would be appreciated.
Currently truthyCoords returns an array of positions that contain a value.
Positions have fields row and col.
I call this method on my shape, which is an array of arrays, roughly of size 4*4 however it is sometimes not.
I then loop through all the truthy coordinates that are returned. In each iteration I add the current truthy co-ordinate to the topLeft position of the shape on the grid to give me this coordinates position on the game grid.
I then check if there is a value on the grid at the added positions row and column.
However, I am getting a "Cannot read property" on
if (this.grid[addedPos.row][addedPos.col] != null) {
Any help would be really appreciated.
Hard mode: Make a clone of std::cin
> swing
>Work as a point of contact between a India and my company (Read: I get angry at Indians for submitting garbage code)
>Work offers me a "promotion" as a project manager for a doomed project
Should I do it, Sup Forums?
>tfw the private tracker I use regularly is looking for programmers with go experience
why do people feel the urge to use meme langs in production?
rust is truly perl-tier syntax-wise
Hype.
Does a private tracker really ever run anything in what one would seriously call "production"
Starting with my news aggregator for Reddit and RSS feeds. I'm not sure how to structure it, but I guess I'll go with trial&error route.
How would you do something like the following very fast in c++?
Float A = 5.0, B = 0.01;
Float r = rand()/1000.0;
For ( float t = 0.0; t < 1000; t += 0.0001)
{
A += 10.0*B + 0.001;
B += 2.0*A*B;
}
std::cout
Hello lads, I am learning C for a DSP class I am taking. Python is the only language I really know (mathfag), so I haven't really dealt with some of this C stuff. Can anyone tell me what the last line of this code is doing?
int I=2147483645;
int ival=-54321;
float fval=(float) ival;
double dval=(double)ival;
int *pval=&ival;
#include
#include
int main() {
std::string buffer;
do {
std::cin >> buffer;
std::cout
Try doing that in C
I think I finally figured it out. I have to check for out of bounds first...
C doesn't have operator overloading
It's taking an int, casting it to a float, casting it to a double and then taking a pointer to it.
It's not really doing anything useful.
Fuck..
I meant
>Float A = 5.0, B = 0.01;
>Float r = rand()/1000.0;
>For ( float t = 0.0; t < 1000; t += 0.0001)
>{
A += 10.0*B*r + 0.001;
B += 2.0*A*B*r;
>}
>std::cout
Impossible then?
wtf are you on about?
it has about 745k users as of september 2
I'd say that's not a small scale site
Lain is trash
explain llvm/clang purpose to me like i am a retard
I guess the exercise is meant to show you how these values are getting stored in memory, as they are getting passed to functions that produce the output.
cf 2b ff ff
00 31 54 c7
00 00 00 00 20 86 ea c0
c4 85 b7 25 ff 7f 00 00
41 42 43 44 45 46
>casting it to a double and then taking a pointer to it.
What does that mean? &ival is the address of ival, right? what is the *pval?
C/C++ goes in, binary comes out
I really don't understand the hate Rust's syntax gets. It's not C, get over it.
>casting it to a double and then taking a pointer to it
it's not
fval is copying the value of ival and casting it to float
dval is copying the value of ival and casting it to double
pval is obtaining and storing the memory address of ival. it has nothing to do with the float/double casts
:: must be stopped
>&ival is the address of ival, right?
Correct.
>what is the *pval?
the expression *pval is the result of dereferencing the address stored in pval, retrieving the int stored there.
In C, declarations usually follow the manner in which identifiers are used. So int *pval; is declaring a variable called pval, and the result of dereferencing pval is an int.
:: is not a problem at all, really. It's the stupid trait based generics which crawls under my skin
Why is that?
pval is a pointer to ival. it essentially contains its memory address, and you can read/modify the memory it points to by using the dereference (*) operator, which you shouldn't mistake with the * on int *pval, that declares a variable of the pointer-to-int type.
Traits are great. I REALLY can't see how anyone would have a problem with them.
In a sane language:
T add (T a, T b, ref bool isTrue){
isTrue = a == b;
return a+b;
}
Do that in Rust
For anyone following along, this is my hopefully correct end result.
Model.prototype.hasCollisions = function () {
var truthyTetros = truthyCoords(this.active.tetromino.shape);
var truthyGrid = truthyCoords(this.grid);
var i, j;
for (i = 0; i < truthyTetros.length -1; i++){
var addedPos = truthyTetros[i].add(this.active.topLeft);
if (addedPos.row < 0 || addedPos.col < 0 ||
addedPos.row > 20 || addedPos.col > 10) { return true; }
if (this.grid[addedPos.row][addedPos.col] != null) { return true; }
}
};
Where do you get the definition of +?
From T
How to do multiplications and additions very fast?
>13/18 C++ chapter finished
fn add(a: T, b: T, is_true: &mut bool) -> T::Output {
*is_true = a == b;
a + b
}
>Add + Eq
There
Absolutely disgusting
That's what the trait does. Now, I would agree if your issue was that Rust doesn't permit inference in function signatures, which would cut down on a lot of the messy stuff.
b should be T::RHS.
>T::RHS
And there
Jesus christ
Actually I was wrong, I forgot about comparing for equality.
It literally just says that T must be addable and Equality comparable, which is defined in the Add and Eq trait.
Add defaults to RHS=T
In C++ it's just
auto add(auto a, auto b, bool& isTrue){
isTrue = (a==b);
return a+b;
}
That signature lies because add doesn't work for any type T, only those types T for which addition and equality are defined.
So jus tlike rust?
>
Never knew you could do this.
Is it possible to take a reference to a variable which implements multiple types?
I forgot about the equality so it actually has to be T. But if you only wanted to add, you should use T::RHS for the most flexibility.
Rust's signature doesn't lie.
Not him, but that's the only option unless you have full type inference.
>implements multiple type
Did you mean traits? I'm confused as to what you mean.
Rust has type inference
>Rust's signature doesn't lie.
So just like D/C++?
It doesn't have full type inference. I don't consider that a bad thing though. Full type inference makes it hard scan over functions.
That's what I mean. You can clearly use multiple traits as constraints for generic type parameters but it'd be cool if you could do it in a dynamic dispatch context too.
> C++
What do people use instead of C++ AMP on Linux?
Unfortunately not, although I don't see why.
Go
Are you saying that has a truthful type signature? It claims to work for all T but it will really only work if == and + are defined for T.
>It claims to work for all T but it will really only work if == and + are defined for T.
Where did you get this information?
From the function body you fucking retard.
Exactly
Good job, you've precluded yourself from having higher rank polymorphism in the language.
I know this is faulty, I'll try to solve it myself.
My question is: does the temp string get overwritten each loop?
int i, result;
char temp[3];
sprintf(string, "* %d! = ", n);
for (i = 0; i < n; i++)
{
sprintf(temp, "%d x ", n - i);
strcat(string, temp);
}
How can I make two variables that the user can input, one of which picks a random number less than the variable the user picked and one of which is more than the number the user picked
I'm using Java
min, max
i like your programming socks. here's your (you)
Literally use the value in a Random. How is this even a question?
I only have Math.random
Is there any metadata saved in relation to a compiled application?
Asking for a friend.
Ok but I fixed my shit now. And the defiantly overlap, is it because i set max array size to 3?
Well, I suppose that's what I get for assuming Java has convenient libraries.
Found this:
int randomWithRange(int min, int max)
{
int range = (max - min) + 1;
return (int)(Math.random() * range) + min;
}
Kinda assumed it would have overloads like C# where you can do muhRandom.Next(min, max);
Having a hard time with a job decision here guys.
I have two job offers. One is with an east coast established firm, fortune 50. The other is with a west coast startup that will probably be successful soon.
East coast giant will pay slightly more, but startup will give equity.
Which one would you choose?
>The other is with a west coast startup that will probably be successful soon
That's what all startups say.
What cities?
c strings are null terminated
e.g., "hello"
is secretly the 6-length char array "hello\0", where \0 is the null-terminator character
"%d = " is *at least* 5 characters: '%d", ' ', '=', ' ', and the implicit '\0'. this assumes that your format arg is only one digit, though; what if somebody did a factorial of 89888888?
just allocate a bigger temp array and don't worry about hitting exactly the right number of characters
That's really not the question. The question is
>How much do you need to live on?
And
>How much are you willing to gamble?
Like, I work for a GSE; it's as stable as stable gets, but I also have a family and can't really take a huge hit to my income.
If you have no real outstanding obligations, go for the new player if you're willing to outright lose the pay difference.
Alright, thanks
this kind of knowledge is nice and all, but can someone even explain the practicality of it? Or is this just something to make you feel smart?
they both have offices in my city so no need to move or anything. startup office is closer to my house, not that it really matters.
i'm already making enough. the difference in salary doesn't really matter. both options would be a raise for me.
i don't have any family (besides a long-term gf) and don't have a mortgage or anything so i'm ready to gamble.
maybe you're right, i should take a gamble in my case.
so i've always been interested in C. i have worked with a couple of scripting languages like php, javascript and some custom languages. i'm a full time english teacher with little to no free time and i would love to spend that time meddling around with quake 3 engine code. where would you advise me to start?
they have like 250 employees currently. they're making money. they're really just trying to expand more at this point.
Personally? I would. Assuming you've already gotten your feet wet, raises for tech in more formal companies level out.
E.g., Entry level in NYC pays 60-70k, 3 years 80-90k, 5 years 100-110k, 7 years 120k. You'll hit a ceiling around this with the same company.
So, you'd probably have to jump ship from that company if you really wanted to keep pay raises going or branch into higher management/directing.
>entry level in NYC pays 60-70k
the fuck? how do they live?
i'm currently living in a low cost city on east coast. making around 90k with 3 years experience.
How do I draw an ascii pine tree with c# using while loops?
i'd advise you to stop
game engines are extremely complex pieces of high-performance software and you shouldn't start diving into one until you know what you're doing with the language
google c tutorials for beginners. write some super basic programs. save engine diving for when you're implicitly comfortable with the language, not when you're just learning it
You live in Jersey. Or with your parents. Or in shitty Brooklyn alone, or good Brooklyn with roommates.
well what i basically wanna do is work on the gameplay stuff not the engine itself. and maybe incorporate a scripting language in the engine to make gameplay programming easier. that's all.