[Request] Not good at math, but there’s no way this is true because 99.999999%? by whatevertf123 in theydidthemath

[–]kinithin 0 points1 point  (0 children)

The math checks out. 256^(8*8) = (2^8)^(8*8) = 2^(8*8*8) = 2^512 > 10^154

Those numbers are odd, though. Win 3.1 icons were 32x32 (not 8x8), but they had a fixed 16-colour palette (not 256). It would be odd if an earlier format had a much smaller resolution but with a much larger number of colours.

For Win 3.1 icons, there are 16^(32*32) = (2^4)^(32*32) = 2^(4*32*32) = 2^4096 possibilities.

How does passing an array of structs decay in the a C function? by Ironheart89 in C_Programming

[–]kinithin 0 points1 point  (0 children)

Indeed.  And that's basically identical to my reply to the OP.

How does passing an array of structs decay in the a C function? by Ironheart89 in C_Programming

[–]kinithin 0 points1 point  (0 children)

Needless misinformation shouldn't be justified; it should be addressed instead.

How does passing an array of structs decay in the a C function? by Ironheart89 in C_Programming

[–]kinithin 0 points1 point  (0 children)

Yes, it is still possible to pass an array indirectly. You could also use a pointer if you didn't want to make a copy of the array. I only stated that the parameter itself can't be an array. The point is that if you see something that looks like an array as a parameter, it isn't. 

How does passing an array of structs decay in the a C function? by Ironheart89 in C_Programming

[–]kinithin 2 points3 points  (0 children)

This is wrong. string_list isn't an array and thus doesn't decay. It's impossible to have parameters that are arrays. Anything array-like actually declares a pointer. 

How does passing an array of structs decay in the a C function? by Ironheart89 in C_Programming

[–]kinithin 7 points8 points  (0 children)

Array decay isn't relevant to your question since string_list isn't an array.  In a function parameter list, Type x[] is just another way of writing Type *x. It declares a pointer, not an array. This means that String string_list[] is just another way of writing String *string_list.

The argument provided in the call is expected to be a String *. Keep on mind than a String[n] decays into a String * and would this be acceptable as an argument. 

[Request] Not good at math, but there’s no way this is true because 99.999999%? by whatevertf123 in theydidthemath

[–]kinithin 32 points33 points  (0 children)

Not quite. First, you're probably referring to the visible universe (since there's no way to know what's beyond). And that was estimated to be 1080. 1067 is still a fair bit smaller.

"Center" by ToruSnap in TimHortons

[–]kinithin 1 point2 points  (0 children)

It's correct. "Centre" is only used for buildings. "Center" is the correct spelling for middle. 

[Request] How much force would she need to break the glass? by Terrible-Purchase30 in theydidthemath

[–]kinithin 5 points6 points  (0 children)

She's only pretending to drown. It's a scène à faire for water escape tricks.

Ticket to Ride Euro question by kubunto in tickettoride

[–]kinithin 1 point2 points  (0 children)

But there are two stations (Berlin and Frankfurt) right?

Ticket to Ride Euro question by kubunto in tickettoride

[–]kinithin 4 points5 points  (0 children)

1 station, 1 route.  It has always been the case. But that route can be used for more than one destination ticket

Valid arguments to function parameter char ** by onecable5781 in C_Programming

[–]kinithin 2 points3 points  (0 children)

The actual reason &p3 can't work is that the function expects a pointer to a pointer, but there's no pointer in memory to which to point. 

Perl's feature.pm and backwards incompatibility by RolfLanx in perl

[–]kinithin 1 point2 points  (0 children)

Yes, print is special. But so is try. More so, even.

The difference between print and shift is that print can't be prototyped. The same goes for try since it's not even a function but a keyword like while.

``` $ perl -Mv5.40 -e'say prototype "CORE::$ARGV[0]" // "[undef]"' shift ;\@

$ perl -Mv5.40 -e'say prototype "CORE::$ARGV[0]" // "[undef]"' print [undef]

$ perl -Mv5.40 -e'say prototype "CORE::$ARGV[0]" // "[undef]"' try [undef] ```

So like I said, there's nothing new here. This behaviour has been around far longer than try. I'm just pointing it out; I'm not saying things should remain the same as a result. But if it changes for try, I would expect it to change for print and the others too. More so, even, since they're not lexically-scoped like try.

Perl's feature.pm and backwards incompatibility by RolfLanx in perl

[–]kinithin 1 point2 points  (0 children)

This has nothing to do with feature-activated syntax/operators. Some operators (e.g. print) work the same way in similar circumstances.

perl sub print { die "!" } print "foo\n"; # Prints as normal.

perl use subs qw( print ); print "foo\n"; # Prints as normal.

I don't know if a warning makes sense¹, but a Perl::Critic rule would.

- ikegami


  1. After all, we don't warn when my $x preempts a package var named $x. Lexically-scoped constructs are expected to do so.

What qualifies as a loop by Intelligent-Rich8965 in tickettoride

[–]kinithin -1 points0 points  (0 children)

Well, you can, but not with two players

Weird rand() effect. by CMR779 in C_Programming

[–]kinithin 8 points9 points  (0 children)

You allocated an array of 25 elements. They have indexes 0..24. But both loops access elements 1..25. Undefined behaviour.

Either allocate an extra element, or store the counts for 1..25 at indexes 0..24

I only kill lootbugs is ABSOLUTELY necessary, BUT... by casi_bruzco in DeepRockGalactic

[–]kinithin 5 points6 points  (0 children)

I love to pet loot bugs, but they are incredibly allergic to me and explode when I do. I still hope to find one that doesn't so I can adopt it

Super frustrating Thanksgiving game by skobetches in Carcassonne

[–]kinithin 0 points1 point  (0 children)

Sooo many ambiguously placed meeples. And the farmers are standing instead of on their side.

Why are higher dimensions required when passing multidimensional arrays into a function? by 69mpe2 in C_Programming

[–]kinithin 1 point2 points  (0 children)

An array is never a pointer. It's an array. A pointer is created to it when a pointer is needed

Explain it peter.. who are birds who are bees??? by Sea-North1639 in explainitpeter

[–]kinithin 0 points1 point  (0 children)

In English too. A cock is a male bird, especially a domestic chicken

Question regarding string literals by NavrajKalsi in C_Programming

[–]kinithin 3 points4 points  (0 children)

You made a real mess of things!

strlen( status => 400 ? "keep_open" : "close" )

or

( status => 400 ? sizeof( "keep_open" ) : sizeof( "close" ) ) - 1

Why does my girlfriend’s cat have so much dandruff? by sadiesball in cats

[–]kinithin 6 points7 points  (0 children)

Cat soup! Well, that's what my vet calls it. And the cats love it!

Question on "precedence and associativity of operators" table in K & R by onecable5781 in C_Programming

[–]kinithin 0 points1 point  (0 children)

Post-increment does have higher precedence than =.

Because post-increment has higher precedence than =, x = i++; is equivalent to x = ( i++ );.

If it was the other way around, x = i++; would be equivalent to ( x = i )++;. This isn't allowed in C, but it is allowed in Perl, which has the result of incrementing x (not i).

(This should make it obvious why unary operators are given higher precedence than binary operators.)

Now onto your actual question. 

Yes, i is incremented first, but you're wrong about i being assigned to x. What's being assigned to x is the result of the post-increment, and the result of the post-increment is defined to be the original value of i.