Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Zopotantor
Feb 24, 2013

...und ist er drin dann lassen wir ihn niemals wieder raus...

fritz posted:

Those that belong to the emperor
Embalmed ones
Those that are trained
Suckling pigs
Mermaids (or Sirens)
Fabulous ones
Stray dogs
Those that are included in this classification
Those that tremble as if they were mad
Innumerable ones
Those drawn with a very fine camel hair brush
Et cetera
Those that have just broken the flower vase
Those that, at a distance, resemble flies

That looks like Cyc
PS: your tags are leaking.

Adbot
ADBOT LOVES YOU

darthbob88
Oct 13, 2011

YOSPOS

Zopotantor posted:

That looks like Cyc
PS: your tags are leaking.

It's actually from Jorge Luis Borges, though apparently it's not too far off reality. One Australian Aboriginal language divides all objects as follows.
  • bayi: men, kangaroos, possums, bats, most snakes, most fishes, some birds, most insects, the moon, storms, rainbows, boomerangs, some spears, etc.
  • balan: women, bandicoots, dogs, platypus, echidna, some snakes, some fishes, most birds, fireflies, scorpions, crickets, the hairy mary grub, anything connected with water or fire, sun and stars, shields, some spears, some trees, etc.
  • balam: all edible fruit and the plants that bear them, tubers, ferns, honey, cigarettes, wine, cake
  • bala: parts of the body, meat, bees, wind, yamsticks, some spears, most trees, grass, mud, stones, noises and language, etc.

darthbob88 fucked around with this message at 18:17 on May 7, 2015

Ruzihm
Aug 11, 2010

Group up and push mid, proletariat!


darthbob88 posted:

It's actually from Jorge Luis Borges, though apparently it's not too far off reality. One Australian Aboriginal language divides all objects as follows.
  • bayi: men, kangaroos, possums, bats, most snakes, most fishes, some birds, most insects, the moon, storms, rainbows, boomerangs, some spears, etc.
  • balan: women, bandicoots, dogs, platypus, echidna, some snakes, some fishes, most birds, fireflies, scorpions, crickets, the hairy mary grub, anything connected with water or fire, sun and stars, shields, some spears, some trees, etc.
  • balam: all edible fruit and the plants that bear them, tubers, ferns, honey, cigarettes, wine, cake
  • bala: parts of the body, meat, bees, wind, yamsticks, some spears, most trees, grass, mud, stones, noises and language, etc.

This is amazing.

Soricidus
Oct 21, 2010
freedom-hating statist shill

darthbob88 posted:

It's actually from Jorge Luis Borges, though apparently it's not too far off reality. One Australian Aboriginal language divides all objects as follows.
  • bayi: men, kangaroos, possums, bats, most snakes, most fishes, some birds, most insects, the moon, storms, rainbows, boomerangs, some spears, etc.
  • balan: women, bandicoots, dogs, platypus, echidna, some snakes, some fishes, most birds, fireflies, scorpions, crickets, the hairy mary grub, anything connected with water or fire, sun and stars, shields, some spears, some trees, etc.
  • balam: all edible fruit and the plants that bear them, tubers, ferns, honey, cigarettes, wine, cake
  • bala: parts of the body, meat, bees, wind, yamsticks, some spears, most trees, grass, mud, stones, noises and language, etc.

Sorry, but this is just the usual colonialist fetishization of foreign cultures. You could do exactly the same thing with der, die, and das in German, and it would look exactly as arbitrary, but the Germans are white and European so nobody thinks their language reveals amazing things about their ~unique way of seeing the world~.

b0lt
Apr 29, 2005

darthbob88 posted:

It's actually from Jorge Luis Borges, though apparently it's not too far off reality. One Australian Aboriginal language divides all objects as follows.
  • bayi: men, kangaroos, possums, bats, most snakes, most fishes, some birds, most insects, the moon, storms, rainbows, boomerangs, some spears, etc.
  • balan: women, bandicoots, dogs, platypus, echidna, some snakes, some fishes, most birds, fireflies, scorpions, crickets, the hairy mary grub, anything connected with water or fire, sun and stars, shields, some spears, some trees, etc.
  • balam: all edible fruit and the plants that bear them, tubers, ferns, honey, cigarettes, wine, cake
  • bala: parts of the body, meat, bees, wind, yamsticks, some spears, most trees, grass, mud, stones, noises and language, etc.

http://en.wikipedia.org/wiki/List_of_Chinese_classifiers#Nominal_classifiers

darthbob88
Oct 13, 2011

YOSPOS

Soricidus posted:

Sorry, but this is just the usual colonialist fetishization of foreign cultures. You could do exactly the same thing with der, die, and das in German, and it would look exactly as arbitrary, but the Germans are white and European so nobody thinks their language reveals amazing things about their ~unique way of seeing the world~.

I'm pretty sure Twain did that, and really you can do that with any language that recognizes grammatical gender or noun class in general. The Diyrbal taxonomy is just especially foreign, and also one that I remembered seeing and marveling at.


ETA: Or for other odd taxonomies, APG3 says that teak is more closely related to oregano than ebony.

darthbob88 fucked around with this message at 20:38 on May 7, 2015

Ruzihm
Aug 11, 2010

Group up and push mid, proletariat!


Soricidus posted:

Sorry, but this is just the usual colonialist fetishization of foreign cultures. You could do exactly the same thing with der, die, and das in German, and it would look exactly as arbitrary, but the Germans are white and European so nobody thinks their language reveals amazing things about their ~unique way of seeing the world~.

Welp I'd better stay ignorant of other cultures. Might find something ~interesting~ if I'm not careful!

Reformed Pissboy
Nov 6, 2003

Some encouraging versioning practices from a header in a test library we're using:

quote:

/*
* $Id: [redacted].h 1.1.1.3.1.6.3.4.1.3.2.8.1.4.1.8.1.1.1.2.1.7.2.17.1.2.10.10.1.2.2.5.1.4.1.1.1.5.1.1.1.4.1.7.1.7 Fri, 06 Aug 2010 16:28:06 +0100 [redacted name] $
*/

(quoted to not break tables)

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer
Now show me the horrible code that autogenerated that poo poo.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

It's the version control identifier from RCS or similar, see the $Id...$.

sarehu
Apr 20, 2007

(call/cc call/cc)
It's not continued fraction versioning?

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

darthbob88 posted:

hairy mary grub

Looks like I found a name for my new close-to-the-metal OS implemented in Javascript and MongoDB, coming soon to Github

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Subjunctive posted:

It's the version control identifier from RCS or similar, see the $Id...$.

Want to see the version history tree of that.

omeg
Sep 3, 2012

Today I learned that gcc allows pointer arithmetic on void* by default.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

omeg posted:

Today I learned that gcc allows pointer arithmetic on void* by default.

With what stride - char?

omeg
Sep 3, 2012

Blotto Skorzany posted:

With what stride - char?

Yeah.

IT BEGINS
Jan 15, 2009

I don't know how to make analogies
php:
<?
function testOnLiveDb()
    {
        pg_query($this->database, "create temp table address_test (a Address)");
        pg_query($this->database, "insert into address_test values ({$this->address->to_sql_row()})");

        list($inserted_address_row) = GetSqlFields($this->database, "SELECT a FROM address_test LIMIT 1");
        $created_address = Address::from_sql_row($inserted_address_row);

        $this->assertEquals("street1", $created_address->street1);
        $this->assertEquals("street2", $created_address->street2);
        $this->assertEquals("Test City", $created_address->city);
        $this->assertEquals("CA", $created_address->state);
        $this->assertEquals("12345", $created_address->zip);
        $this->assertEquals("US", $created_address->country);
        $this->assertEquals("cmp", $created_address->company);
        $this->assertEquals("nm", $created_address->name);
        $this->assertEquals("ph", $created_address->phone);
    }
?>
Nonononononononononononononononoooooooooooooooooooooo

FlapYoJacks
Feb 12, 2009
:stare:

At least the function name is self documenting! :smug:

piratepilates
Mar 28, 2004

So I will learn to live with it. Because I can live with it. I can live with it.



ratbert90 posted:

:stare:

At least the function name is self documenting! :smug:

Until it turns out it's just a hard coded mock, and the 'innocuousTestingFunction' is the one that works on a live database.

IT BEGINS
Jan 15, 2009

I don't know how to make analogies
php:
<?
abstract class Super
{
    static function build($params)
    {
        if ($params['something'])
            return new Sub();
    }
}

class Sub extends Super
{
    function doSomeStuff()
    {
        // do some stuff
    }
}
?>
This is paraphrased, since it's some company-specific code. But this is essentially what we have. A superclass with no other methods except that build (though the real one can create one of many child classes) and a child class which extends it.

WHY IS IT EXTENDED? WHY DO THE TESTS CALL THE DATABASE WHEN THESE CLASSES DEAL WITH XML ONLY? WY IS GLOBAL $DATABASE EVERYWHERE? WHYWHYWHYWHYWHY

Edit: ok, going for a walk. I thought I had seen bad - no. I just opened a subdirectory that will give me nightmares for months.

IT BEGINS fucked around with this message at 21:12 on May 8, 2015

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

omeg posted:

Today I learned that gcc allows pointer arithmetic on void* by default.

Why wouldn't/shouldn't it?

Space Kablooey
May 6, 2009



seveeer

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Cocoa Crispies posted:

Why wouldn't/shouldn't it?

It seems like a weird thing to give meaning to. Given that pointer arithmetic "knows about" the size of objects and there's no way to define the size of "void", what would it naturally mean? Anyway, more concretely, the top answer to this Stack Overflow post gives some detailed reasoning as to why it shouldn't work. How accurate it is I'm not really fit to judge, but that site is reasonably stocked with pedants so I assume it would have been voted down if it were dodgy in any way.

QuarkJets
Sep 8, 2008

Cocoa Crispies posted:

Why wouldn't/shouldn't it?

because void is an incomplete type and has no size

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Cocoa Crispies posted:

Why wouldn't/shouldn't it?

It's illegal and there are no semantics for it that really make sense, making it a great footgun; also, since char* is allowed to alias anything (and has clear semantics) there are no circumstances where doing arithmetic on void* would add any capability that isn't already there.

Spatial
Nov 15, 2007

It's very simple to implement in the compiler and saves you one or two casts somewhere in C code. That's probably the real reason.

Joda
Apr 24, 2010

When I'm off, I just like to really let go and have fun, y'know?

Fun Shoe
OpenGL relies on void pointers for uploading data (and information on how to format it) to the GPU. When relevant you can specify strides, offsets and what type of data you're giving it. I don't know how common it is at large, but there's at least that one very big thing it's necessary for.

Spatial
Nov 15, 2007

Actually that reminds me of a horror at work.

We have an event-driven system written in C that uses function pointers quite a lot. The type of an event callback pointer is a void returning function with one void pointer parameter. However in actual use the pointer is always to one specific well-defined type. The very first thing in every handler is a cast to that type from void*. Good luck if you pass anything else in there. You won't get a warning.

Now this is merely stupid. The real horror is that somehow it wound up being cargo-culted into many other functions which aren't event handlers, which are never pointed to, and even take other parameters in addition to the void-pointer-which-actually-means-this-other-type one.

The originating reason for all of this: the person who originally defined the types couldn't figure out how to define the function pointer type because the struct it points to contains the function pointer type. It's self-referential. C and its bad old declaration order requirements once again conspire with bad programmers to create a rat's nest.

Honestly it's fascinating reading through the code and discovering things like this. It's code archeology!

sarehu
Apr 20, 2007

(call/cc call/cc)

Joda posted:

OpenGL relies on void pointers for uploading data (and information on how to format it) to the GPU. When relevant you can specify strides, offsets and what type of data you're giving it. I don't know how common it is at large, but there's at least that one very big thing it's necessary for.

Not at all, you just use char *.

Joda
Apr 24, 2010

When I'm off, I just like to really let go and have fun, y'know?

Fun Shoe
I always cast to void*, didn't know you could cast to char*. I don't really see how it matters when you always tell it how the data is formatted anyway? Or maybe I have been the horror all along.

Joda fucked around with this message at 21:02 on May 8, 2015

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



IT BEGINS posted:

php:
<?
abstract class Supe
{
    static function build($params)
    {
        if ($params['something'])
            return new Sub();
    }
}

class Sub extends Super
{
    function doSomeStuff()
    {
        // do some stuff
    }
}
?>
This is paraphrased, since it's some company-specific code. But this is essentially what we have. A superclass with no other methods except that build (though the real one can create one of many child classes) and a child class which extends it.

WHY IS IT EXTENDED? WHY DO THE TESTS CALL THE DATABASE WHEN THESE CLASSES DEAL WITH XML ONLY? WY IS GLOBAL $DATABASE EVERYWHERE? WHYWHYWHYWHYWHY

Edit: ok, going for a walk. I thought I had seen bad - no. I just opened a subdirectory that will give me nightmares for months.

The parent class actually just makes one of its children? That's not a typo?

IT BEGINS
Jan 15, 2009

I don't know how to make analogies

Munkeymon posted:

The parent class actually just makes one of its children? That's not a typo?

Not a typo. The parent class is just a Factory that constructs its children via a static method.

IT BEGINS fucked around with this message at 21:12 on May 8, 2015

FlapYoJacks
Feb 12, 2009

QuarkJets posted:

because void is an incomplete type and has no size

But the pointer to the void might. :v:

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer
I don't mind void * arithmetic ad a shorthand for doing things 1 byte at a time, but it would be better if there was some type of genetic byte * you could cast to. I think it's weird to cast random structs and such to chars for math. It's kinda inscrutable when you don't already know what's up with those casts.

Dylan16807
May 12, 2010

LeftistMuslimObama posted:

I don't mind void * arithmetic ad a shorthand for doing things 1 byte at a time, but it would be better if there was some type of genetic byte * you could cast to. I think it's weird to cast random structs and such to chars for math. It's kinda inscrutable when you don't already know what's up with those casts.
Just pronounce 'char' as byte. It is the generic byte type. That's a far deeper weirdness of C than the casting goes.


Also I feel like if someone needs a recursively-typed callback in a struct they should be able to figure out they need to forward declare the struct, and doing so has trivial syntax.

Jeb Bush 2012
Apr 4, 2007

A mathematician, like a painter or poet, is a maker of patterns. If his patterns are more permanent than theirs, it is because they are made with ideas.
It's less weird when you know that historically a byte was defined as the space it takes to store a single character, rather than either meaning "8 bits" or "the smallest addressable unit of memory" like it tends to nowadays.

Fergus Mac Roich
Nov 5, 2008

Soiled Meat

LeftistMuslimObama posted:

I don't mind void * arithmetic ad a shorthand for doing things 1 byte at a time, but it would be better if there was some type of genetic byte * you could cast to. I think it's weird to cast random structs and such to chars for math. It's kinda inscrutable when you don't already know what's up with those casts.

What problems would you likely run into with a simple typedef?

fritz
Jul 26, 2003

Jeb Bush 2012 posted:

It's less weird when you know that historically a byte was defined as the space it takes to store a single character, rather than either meaning "8 bits" or "the smallest addressable unit of memory" like it tends to nowadays.

How does this hypothesis explain having 8 bit bytes but 7 bit characters?

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

fritz posted:

How does this hypothesis explain having 8 bit bytes but 7 bit characters?

Rounding up to a power of two.

Adbot
ADBOT LOVES YOU

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Spatial posted:

The originating reason for all of this: the person who originally defined the types couldn't figure out how to define the function pointer type because the struct it points to contains the function pointer type. It's self-referential. C and its bad old declaration order requirements once again conspire with bad programmers to create a rat's nest.

Which is silly, because you write it in exactly the same way you would write any other self-reference within a struct definition: with "struct foo" instead of whatever typedef you're about to introduce. (Or you just typedef a forward declaration before defining the struct.) Anybody who has written a tree in C should be completely comfortable with this.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply