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
JawnV6
Jul 4, 2004

So hot ...

ExcessBLarg! posted:

C, which has very little of a runtime doesn't mask these at all and so "foists" the problems on the programmer. Managed languages tend to hide these to the benefit of the programmer, but which otherwise may have consequence in being able to write low level systems code.

This, but more words: Threads Cannot Be Implemented As a Library

Adbot
ADBOT LOVES YOU

Pavlov
Oct 21, 2012

I've long been fascinated with how the alt-right develops elaborate and obscure dog whistles to try to communicate their meaning without having to say it out loud
Stepan Andreyevich Bandera being the most prominent example of that

Suspicious Dish posted:

Python exposes fork, heavily uses it (multiprocessing), also exposes threads, and can use threads behind your back, and also exposes libraries incompatible with fork (ctypes).

Python is an awful language for doing both of those things though. The runtime just wasn't designed with parallelism in mind.

ExcessBLarg!
Sep 1, 2001

Suspicious Dish posted:

Python exposes fork, heavily uses it (multiprocessing), also exposes threads, and can use threads behind your back, and also exposes libraries incompatible with fork (ctypes).
CPython also has a Global Interpreter Lock (GIL) which prevents multiple threads from executing Python bytecode concurrently.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
I wish I could fork this thread

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

MALE SHOEGAZE posted:

I wish I could fork this thread

You can.

KaneTW
Dec 2, 2011

code:
$ git clone 'https://forums.somethingawful.com/showthread.php?threadid=2803713'
Cloning into 'showthread.php?threadid=2803713'...
fatal: http://forums.somethingawful.com/showthread.php?threadid=2803713/info/refs not valid: is this a git repository?
:confused:

pseudorandom name
May 6, 2007

ExcessBLarg! posted:

So unless the library is a thread library, it shouldn't ever call pthread_create(3) or clone(2) behind my back. Any API call that does need to prominently state in its documentation that, that's the behavior. Ideally is should also be obvious by the function name alone that it's likely to spawn a thread.

You just don't, do that.

Yes, on Unix/Linux.

On non-garbage platforms a library creating threads for its own internal use is a perfectly fine thing to do.

ErIog
Jul 11, 2001

:nsacloud:

KaneTW posted:

code:
$ git clone 'https://forums.somethingawful.com/showthread.php?threadid=2803713'
Cloning into 'showthread.php?threadid=2803713'...
fatal: [url]http://forums.somethingawful.com/showthread.php?threadid=2803713/info/refs[/url] not valid: is this a git repository?
:confused:

Is there anyone running a message board by abusing Git commit/merge/clone/message behavior yet? That would qualify for this thread.

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

pseudorandom name posted:

Yes, on Unix/Linux.

On non-garbage platforms a library creating threads for its own internal use is a perfectly fine thing to do.

Agreed, all Unix operating systems are garbage and should not be used at any time.

Qwertycoatl
Dec 31, 2008

ErIog posted:

Is there anyone running a message board by abusing Git commit/merge/clone/message behavior yet? That would qualify for this thread.

Not exactly, but

KaneTW
Dec 2, 2011

ErIog posted:

Is there anyone running a message board by abusing Git commit/merge/clone/message behavior yet? That would qualify for this thread.

I kinda want to do that now.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Cryptographically verified shitposting.

ErIog
Jul 11, 2001

:nsacloud:

Qwertycoatl posted:

Not exactly, but


That's just an HR person not understanding the directions they were given, right? Please?

it is
Aug 19, 2011

by Smythe
More like a business founder I think but yeah, just a non-technical person guessing wrong about things

TheresaJayne
Jul 1, 2011

KaneTW posted:

code:
$ git clone 'https://forums.somethingawful.com/showthread.php?threadid=2803713'
Cloning into 'showthread.php?threadid=2803713'...
fatal: [url]http://forums.somethingawful.com/showthread.php?threadid=2803713/info/refs[/url] not valid: is this a git repository?
:confused:

I so want a like button for this - this is Awesome and brilliant!

Karate Bastard
Jul 31, 2007

Soiled Meat

ErIog posted:

That's just an HR person not understanding the directions they were given, right? Please?

No. Some posts may come at an inopportune moment, so to give them the notability they deserve it's critical to have an online experience where posts can be relocated to the optimal context. This is a thus far unexplored community building mechanism which it has now become possible to implement thanks to the novel git rebase technology. For example:

code:
git checkout metoo # erroneously posted after "I think OP is wrong about everything"
git rebase imgay
Likewise, for optimal posting quality, it is necessary to be able to have a posting staging area with infinite stash depth, which has only now been enabled, also via the rich git feature set. Furthermore, if a discussion veers in an undesired direction, for example toward a conclusion that is not in line with current goals, you can easily conclude it in a posting timeline of your own using git clone technology, and refer to it when making passing remarks to your success in other contexts.

Edison was a dick
Apr 3, 2010

direct current :roboluv: only

ErIog posted:

Is there anyone running a message board by abusing Git commit/merge/clone/message behavior yet? That would qualify for this thread.

If you don't look so closely, you could do it with https://ikiwiki.info/. It's a blog/wiki engine that's backed by git. Comments posted on articles in the web UI get turned into commits, but you can pull/push content as git commits.

Karate Bastard
Jul 31, 2007

Soiled Meat
So that's eh.... the icky wiki?

e: vvvvv That'd be terrible! Who'd mod this? I know! Either autistic sperglords, or just punish the shitposters by prescribing them a period of moderation duty, where they cannot post, but only read shitposts. That's bril... oh wait.

Karate Bastard fucked around with this message at 10:01 on Feb 10, 2015

VikingofRock
Aug 24, 2008




In the git forums posts are submitted by pull request; thus they must be moderator approved before being merged into the forums. No more shitposts!

Edison was a dick
Apr 3, 2010

direct current :roboluv: only

Karate Bastard posted:

So that's eh.... the icky wiki?

Yup, that's how you pronounce it.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

TheresaJayne posted:

I so want a like button for this - this is Awesome and brilliant!

Surely you mean you wish to star and fork this idea.

Linear Zoetrope
Nov 28, 2011

A hero must cook

Internet Janitor posted:

Surely you mean you wish to star and fork this idea.

If you like this repository, don't forget to star, fork, watch, and file an issue!

JawnV6
Jul 4, 2004

So hot ...

ErIog posted:

That's just an HR person not understanding the directions they were given, right? Please?

it is posted:

More like a business founder I think but yeah, just a non-technical person guessing wrong about things
Er, and y'all are just giving a pass to the technical person who couldn't sit down for a few minutes to actually check the language being used?

it is
Aug 19, 2011

by Smythe
The business is in the ideation stage.

Munkeymon
Aug 14, 2003

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



I'm ~80% sure I've seen someone using GitHub as a blogging platform before and actually using a source control system to version a wiki makes a lot of sense to me :shrug:

JawnV6 posted:

Er, and y'all are just giving a pass to the technical person who couldn't sit down for a few minutes to actually check the language being used?

Nontechnical people say the darndest things! Isn't it cwute :3:

Karate Bastard
Jul 31, 2007

Soiled Meat
To be less flippant, Github+jekyll+pandoc is a fantastic way to do web.

Linear Zoetrope
Nov 28, 2011

A hero must cook

Jsor posted:

This is really just a newbie mistake and not a terrible horror, but it's such a basic memory bug it's kind of cute.

They're given this struct:

code:
typedef struct {
    int cap;
    TYPE *arr;
} DynArr;
Then they have to implement basic dynamic array/slice methods
code:
void _dynArrSetCapacity(DynArr *v, int newCap)
{
    assert(v != 0);
    assert(newCap > 0);
    DynArr *newV = realloc(v, newCap * sizeof(v));
    v = newV;
}
No, buddy, you're accidentally making an array of dynamic arrays and your pointer reassignment doesn't really do anything. :shobon:

The instructor just made this same mistake on the answer sheet to the midterm. Which I think sends this from :shobon: to horror.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Jsor posted:

The instructor just made this same mistake on the answer sheet to the midterm. Which I think sends this from :shobon: to horror.

I was once wary of doing things like sizeof *v because I thought "what if v is null?" Then someone pointed out that sizeof is a compile-time thing and all was well.

I don't think it helps that people usually put the parentheses after sizeof like it's a function call. I'm not saying that's a bad idea, just that it added to my confusion.

Steve French
Sep 8, 2003

pokeyman posted:

I was once wary of doing things like sizeof *v because I thought "what if v is null?" Then someone pointed out that sizeof is a compile-time thing and all was well.

I don't think it helps that people usually put the parentheses after sizeof like it's a function call. I'm not saying that's a bad idea, just that it added to my confusion.

When I still wrote C for work I'd see a lot of:

code:

SomeType *v ...
...
...sizeof(SomeType)

in some later code relating to v, and I would always suggest sizeof(*v), and get pushback for that exact reason.

I also always get a chuckle out of sizeof(char)

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Steve French posted:

When I still wrote C for work I'd see a lot of:

code:
SomeType *v ...
...
...sizeof(SomeType)
in some later code relating to v, and I would always suggest sizeof(*v), and get pushback for that exact reason.

I also always get a chuckle out of sizeof(char)

I think the latter is fine. It's just avoiding magic numbers.

The Laplace Demon
Jul 23, 2009

"Oh dear! Oh dear! Heisenberg is a douche!"

LeftistMuslimObama posted:

I think the latter is fine. It's just avoiding magic numbers.

Yeah, really don't get why people scoff at that. You, the compiler and I all know it's equal to 1. Sometimes I put sizeof(char) to show the units are "bytes" or for symmetry with other statements. It doesn't make my code any less correct or efficient. :shrug:

The Laplace Demon fucked around with this message at 06:00 on Feb 11, 2015

Steve French
Sep 8, 2003

It's not a magic number, that is how sizeof is defined by the C spec. I'm not saying it is a horror to write it, just that I find it mildly amusing.

Coffee Mugshot
Jun 26, 2010

by Lowtax

Steve French posted:

It's not a magic number, that is how sizeof is defined by the C spec. I'm not saying it is a horror to write it, just that I find it mildly amusing.

I think what he meant was using the literal 1 is a magic number in comparison to using sizeof(char) even if you know they are the same thing.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Similarly spelling out 4 * 1024 * 1024 for 4MB, or 60 * 60 * 24 for seconds-in-a-day. Express the significance of something, not just the resulting value.

shodanjr_gr
Nov 20, 2007
I always type out pi to an arbitrary precision rather than utilize a constant.

VikingofRock
Aug 24, 2008




shodanjr_gr posted:

I always type out pi to an arbitrary precision rather than utilize a constant.

I always write a constexpr function which calculates pi to arbitrary decimal places, the number of which are specified at compile time.

shodanjr_gr
Nov 20, 2007

VikingofRock posted:

I always write a constexpr function which calculates pi to arbitrary decimal places, the number of which are specified at compile time.

I'll only respect that if the precision is expressed using sizeof some random struct.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

VikingofRock posted:

I always write a constexpr function which calculates pi to arbitrary decimal places, the number of which are specified at compile time.

same, but binary places

TZer0
Jun 22, 2013
Anonymized code:
code:
std::vector<SomeClass> varName;
ASSERT_EQ(0, (int)varName.size());
Someone must be paranoid.

Adbot
ADBOT LOVES YOU

TheresaJayne
Jul 1, 2011

TZer0 posted:

Anonymized code:
code:
std::vector<SomeClass> varName;
ASSERT_EQ(0, (int)varName.size());
Someone must be paranoid.

I worked on a Bukkit Plugin once and EVERY and i mean EVERY! line had casting so it went something like this

code:
Player player = (Player)world.getPlayer();
Storage storage = (Storage)player.getStorage();
Apparently he was new to java and learnt that things worked when cast so he just did it.

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