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.
 
  • Locked thread
fritz
Jul 26, 2003

terrible programmer here, can't keep straight git/repo/gerrit/??? integration. what gets pushed where and how? no freaking clue. does everything go in one commit? which do I branch first? what's a branch name and what's a magic git string?

Adbot
ADBOT LOVES YOU

Nomnom Cookie
Aug 30, 2009



Arboc posted:

if you're using their browser, they'll talk to it using SPDY instead of http

a custom server written in a custom language, to serve files from a custom filesystem over a custom protocol. google is the most nih place in the universe

Greed is eternal
Jun 8, 2008

fritz posted:

terrible programmer here, can't keep straight git/repo/gerrit/??? integration. what gets pushed where and how? no freaking clue. does everything go in one commit? which do I branch first? what's a branch name and what's a magic git string?

Couldn't really parse that. The golden rule when to branch and when to just commit is: if you can come up with a good branch name, you should branch.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

git clone trooper posted:

the public/private debate is like people who are worried about polluting global in javascript

yeah it can technically be a problem but come on

there's no reason to care about public/private on a project that wont need to be utilized by programmers unfamiliar with its code, which is everything i will ever work on because i'm a bad programmer who will never write something other people want to use.

however i still worry about it just for the purpose of making myself slightly less terrible.

fritz
Jul 26, 2003

Greed is eternal posted:

Couldn't really parse that. The golden rule when to branch and when to just commit is: if you can come up with a good branch name, you should branch.

theres some android tool called repo and a code review thing called gerrit. repo overlays git. there are repo branches and git branches and they each have their own ways of switching between them and pushing to gerrit and/or the git central repo.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

fritz posted:

theres some android tool called repo and a code review thing called gerrit. repo overlays git. there are repo branches and git branches and they each have their own ways of switching between them and pushing to gerrit and/or the git central repo.

that doesnt sound confusing at all

Nomnom Cookie
Aug 30, 2009



USSMICHELLEBACHMAN posted:

there's no reason to care about public/private on a project that wont need to be utilized by programmers unfamiliar with its code, which is everything i will ever work on because i'm a bad programmer who will never write something other people want to use.

however i still worry about it just for the purpose of making myself slightly less terrible.

if u just wanna spooge out code to git r done then go hog wild on public fields imo. but then the change requests come in

Nomnom Cookie
Aug 30, 2009



fritz posted:

theres some android tool called repo and a code review thing called gerrit. repo overlays git. there are repo branches and git branches and they each have their own ways of switching between them and pushing to gerrit and/or the git central repo.

just use git you don't need some extra sperg on top. git is enough sperg

fritz
Jul 26, 2003

Nomnom Cookie posted:

just use git you don't need some extra sperg on top. git is enough sperg

agree but: not my choice at all.

MeruFM
Jul 27, 2010
so other than public and private, does anyone use protected or normal?

I was tutoring yesterday, teaching the no-modifier scope and realized i have no opinion on this other than use the smallest scope possible. The student asked why and I had no answer.

Also python __myPrivates

GameCube
Nov 21, 2006

protected is for when something needs to be accessible by subclasses, u dork

MeruFM
Jul 27, 2010
was just wondering because people are only talking about private and public

Nomnom Cookie
Aug 30, 2009



protected is kinda dumb because subclassing is kinda dumb

package private sucks cause you see some method you wanna call and you're like YEAH THAT'S WHAT I NEED but you can't call it because its package private and ur like nnnnnggghh i hate you guy who made this method package private. but its ok for methods that are like "ya this should be private but i really really want to call it from my unit test" so you make it package private instead

Nomnom Cookie
Aug 30, 2009



420 mutilate ur code for testing purposes erryday

ConanTheLibrarian
Aug 13, 2004


dis buch is late
Fallen Rib

Nomnom Cookie posted:

"ya this should be private but i really really want to call it from my unit test"

that's what reflection is for!! Well that and padding your LOC count

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

ConanTheLibrarian posted:

that's what reflection is for!! Well that and padding your LOC count

:suicide: just package private it

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY

Nomnom Cookie posted:

protected is kinda dumb because subclassing is kinda dumb

package private sucks cause you see some method you wanna call and you're like YEAH THAT'S WHAT I NEED but you can't call it because its package private and ur like nnnnnggghh i hate you guy who made this method package private. but its ok for methods that are like "ya this should be private but i really really want to call it from my unit test" so you make it package private instead

ive had a different problem recently with package private: there's a lot of stuff that i feel i should mark package private because it isn't part of the package's interface, but i mark it public because my unit tests are in a different package.

(and my unit tests are in a different package because autofixture needs a later version of mono than unity3d will compile :()

fortunately this is a personal project so who the hell cares~

Morkai
May 2, 2004

aaag babbys

coffeetable posted:

ive had a different problem recently with package private: there's a lot of stuff that i feel i should mark package private because it isn't part of the package's interface, but i mark it public because my unit tests are in a different package.

(and my unit tests are in a different package because autofixture needs a later version of mono than unity3d will compile :()

fortunately this is a personal project so who the hell cares~

friend assemblies or private accessors?

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY

Morkai posted:

friend assemblies

WELP.

glad this is the terrible programmer thread

Morkai
May 2, 2004

aaag babbys

coffeetable posted:

WELP.

glad this is the terrible programmer thread

yw.

Nomnom Cookie
Aug 30, 2009



Morkai posted:

friend assemblies or private accessors?

what in the blue hell is a friend assembly. it sounds like a terrible idea

Morkai
May 2, 2004

aaag babbys

Nomnom Cookie posted:

what in the blue hell is a friend assembly. it sounds like a terrible idea

it is more or less what it sounds like.
http://msdn.microsoft.com/en-us/library/0tke9fxk.aspx

probably a bad idea, yeah, but it seems to be effective.

Morkai fucked around with this message at 06:35 on Jan 15, 2014

Bloody
Mar 3, 2013

Shaggar posted:

always triple your estimates is project management 201

Bloody
Mar 3, 2013

MeruFM posted:

so other than public and private, does anyone use protected or normal?

I was tutoring yesterday, teaching the no-modifier scope and realized i have no opinion on this other than use the smallest scope possible. The student asked why and I had no answer.

Also python __myPrivates

unmodified scope is great when you want something promiscuous in your package but unmolested beyond

so yeah i guess its pretty limited but w/e

i used it once i dont remember what for

Morkai
May 2, 2004

aaag babbys

Bloody posted:

promiscuous in your package but unmolested

i used it once i dont remember what for

incredible

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:

Nomnom Cookie posted:

package private is ok for methods that are like "ya this should be private but i really really want to call it from my unit test" so you make it package private instead
qft

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:

Bloody posted:

something promiscuous in your package but unmolested beyond

i guess its pretty limited but w/e

i used it once i dont remember what for

hehe

gonadic io
Feb 16, 2011

>>=
so dumb c question: i currently have
code:
solution* current_best = (solution*)malloc(sizeof(solution));
current_best->foo = 0;
current_best->bar = 0;
current_best->baz_ptr = NULL;
can i replace this with something like
code:
solution* current_best = (solution*)malloc(sizeof(solution));
*current_best = {0,0,NULL};
?? i don't really understand how strut literals work or where they're allocated or whatever

gonadic io fucked around with this message at 16:48 on Jan 15, 2014

Nomnom Cookie
Aug 30, 2009



calloc

gonadic io
Feb 16, 2011

>>=
ok but what about for the case where they're not all 0?

e: and also, does the pointer have the same size as the ints? or is {0,0,NULL} the same as 00000000000 or whatever in memory i.e. the size i give calloc is that of the whole struct?

gonadic io fucked around with this message at 16:56 on Jan 15, 2014

fritz
Jul 26, 2003

Nomnom Cookie posted:

what in the blue hell is a friend assembly. it sounds like a terrible idea

its the compilation unit where you put the nice functions

Nomnom Cookie
Aug 30, 2009



AlsoD posted:

ok but what about for the case where they're not all 0?

e: and also, does the pointer have the same size as the ints? or is {0,0,NULL} the same as 00000000000 or whatever in memory i.e. the size i give calloc is that of the whole struct?

use a macro. macros are cool & fun

Pie Colony
Dec 8, 2006
I AM SUCH A FUCKUP THAT I CAN'T EVEN POST IN AN E/N THREAD I STARTED

AlsoD posted:

ok but what about for the case where they're not all 0?

e: and also, does the pointer have the same size as the ints? or is {0,0,NULL} the same as 00000000000 or whatever in memory i.e. the size i give calloc is that of the whole struct?

pointers are not always the same size as an integer. also, null is not always represented by a 0 in memory.

calloc is for arrays, not structs.

you can do something like this:

code:
solution* current_best = malloc(sizeof(solution));
*current_best = (solution){0,0,NULL};
oh yea dont cast malloc either

Zombywuf
Mar 29, 2008

AlsoD posted:

so dumb c question: i currently have
code:
solution* current_best = (solution*)malloc(sizeof(solution));
current_best->foo = 0;
current_best->bar = 0;
current_best->baz_ptr = NULL;
can i replace this with something like
code:
solution* current_best = (solution*)malloc(sizeof(solution));
*current_best = {0,0,NULL};
?? i don't really understand how strut literals work or where they're allocated or whatever

Basic rule of thumb is you don't need to give a poo poo about where things are allocated in C unless you call malloc. Temporaries are in general not actually allocated.

Nomnom Cookie
Aug 30, 2009



Pie Colony posted:

pointers are not always the same size as an integer. also, null is not always represented by a 0 in memory.

calloc is for arrays, not structs.

you can do something like this:

code:
solution* current_best = malloc(sizeof(solution));
*current_best = (solution){0,0,NULL};
oh yea dont cast malloc either

whats the difference between calloc'ing 1 element and malloc + memset

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

AlsoD posted:

so dumb c question: i currently have
code:
solution* current_best = (solution*)malloc(sizeof(solution));
current_best->foo = 0;
current_best->bar = 0;
current_best->baz_ptr = NULL;
can i replace this with something like
code:
solution* current_best = (solution*)malloc(sizeof(solution));
*current_best = {0,0,NULL};
?? i don't really understand how strut literals work or where they're allocated or whatever

code:

struct boner b = {.length = 0,.girth = 0,.lastUsedBy = NULL}

struct boner *ptr = malloc(sizeof(struct boner))
*ptr = b

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band
is it wrong to get irritated when an ide highlights a variable to let me know it's unused even though i just typed the stupid thing out and i'm going to use it in a second? it's not really an error yet, dammit :argh:

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

Nomnom Cookie posted:

whats the difference between calloc'ing 1 element and malloc + memset

calloc will sometimes allocate from a CoW'd page of all zeros so it's maybe faster

Bloody
Mar 3, 2013

prefect posted:

is it wrong to get irritated when an ide highlights a variable to let me know it's unused even though i just typed the stupid thing out and i'm going to use it in a second? it's not really an error yet, dammit :argh:

this flares the autism

Adbot
ADBOT LOVES YOU

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

Bloody posted:

this flares the autism

that's what i was afraid of :saddowns:

  • Locked thread