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
shrughes
Oct 11, 2008

(call/cc call/cc)

rjmccall posted:

Sorry, I meant "block results that are clearly unused". The only case where that's not trivial to decide at parse-time is a function body result. In the absence of an explicit void type annotation, emitting a type-mismatch error there seems preferable to making semicolons significant. Sorry that you like to turn trivial implementation hurdles into annoyances for your users, though.

Are you seriously writing while loops and getting angry when you forget the semicolon on the last statement and the code doesn't compile?

Adbot
ADBOT LOVES YOU

Gul Banana
Nov 28, 2003

as someone who's had to do a couple of years' work in VB.NET, writing complex functional-style code in an environment where even its ternary operator is unreliable and type inference regularly fails, i would really like a good expression language about now

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

shrughes posted:

Are you seriously writing while loops and getting angry when you forget the semicolon on the last statement and the code doesn't compile?

I don't use Rust.

This semicolon thing is not a great evil. It is not devilishly difficult to master. It is, however, a silly and unnecessary wart forced by a long series of poor decisions by people whose concept of language design is just thoughtlessly copying poo poo out of languages that they consider sophisticated and cool. You will note that the history of this particular feature in Rust appears to have been: (1) Graydon wanted statements, (2) Graydon got tired of arguing about it, (3) Graydon put it up for a vote with a reasonable discussion of the merits of all the options, and then (4) the hipster brigade swarmed in saying "rah-rah expression languages are awesome".

Zombywuf
Mar 29, 2008

So assuming the opposite of expression language is statement language; care to name a statement language that doesn't have warts caused by that decision?

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av
Found in our iOS app:

Objective-C code:
#import "NSDateAdditions.h"


@implementation NSDate (NSDateAdditions)


- (NSString *)formatHuman
{
    NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];

    unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit |  NSDayCalendarUnit | NSWeekdayCalendarUnit;
    NSCalendar *calendar = [NSCalendar currentCalendar];

    NSDateComponents *comps = [calendar components: unitFlags fromDate: self];
    [comps setHour: 0];
    [comps setMinute: 0];
    [comps setSecond: 0];

    NSDate *suppliedDate = [calendar dateFromComponents: comps];
    
    [formatter setDateStyle: NSDateFormatterNoStyle];
    [formatter setTimeStyle: NSDateFormatterShortStyle];
    
    NSString *timeoOnly = [formatter stringFromDate: self];
   
    for(int i = -1; i < 7; i++) {

        comps = [calendar components: unitFlags fromDate: [NSDate date]];
        [comps setHour: 0];
        [comps setMinute: 0];
        [comps setSecond: 0];
        [comps setDay: [comps day] - i];

        NSDate *referenceDate = [calendar dateFromComponents: comps];

        int weekday = [[calendar components: unitFlags fromDate: referenceDate] weekday] - 1;

        if ([suppliedDate compare: referenceDate] == NSOrderedSame && i == -1) {
            // Tomorrow

            return [NSString stringWithFormat:@"%@ %@", NSLocalizedString(@"IPHONE_TOMORROW", nil), timeoOnly];
        }

        else if ([suppliedDate compare: referenceDate] == NSOrderedSame && i == 0) {
            // Today's time (a la iPhone Mail)
            
            return [formatter stringFromDate: self];
        
        }else if ([suppliedDate compare: referenceDate] == NSOrderedSame && i == 1) {
            // Yesterday
            
            return [NSString stringWithFormat:@"%@ %@", NSLocalizedString(@"IPHONE_YESTERDAY", nil), timeoOnly];
        }

        else if ([suppliedDate compare: referenceDate] == NSOrderedSame) {
            // Day of the week

            NSString *day = [[formatter weekdaySymbols] objectAtIndex: weekday];
            NSString *fullDate = [NSString stringWithFormat:@"%@ %@", day, timeoOnly];
            return fullDate;
        }
    }

    [formatter setDateStyle: NSDateFormatterShortStyle];
    [formatter setTimeStyle: NSDateFormatterNoStyle];
    NSString *defaultDate = [formatter stringFromDate: self];
    NSString *fullDate = [NSString stringWithFormat:@"%@ %@", defaultDate, timeoOnly];
    return fullDate;
}

@end
Please note:
  • two formatters re-created every time, always identical (creating formatters is, apparently, incredibly expensive)
  • uses a loop to subtract two dates
  • every time it loops, it recalculates stuff that never changes
  • pastes together localized strings with no regards for actual localization

According to the profiler, this treasure of programming accounts for :eyepop: ~40% of our CPU time under stress (to be fair, part of it due to the fact that it's called unnecessarily often)

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy
Man, I keep forgetting how ugly Objective-C looks. That bracket notation with required named parameters makes for some hideous code.

Hughlander
May 11, 2005

Bognar posted:

Man, I keep forgetting how ugly Objective-C looks. That bracket notation with required named parameters makes for some hideous code.

I think in the example it's the space after the named parameter.

What's written above as:
int weekday = [[calendar components: unitFlags fromDate: referenceDate] weekday] - 1;
Is usually written as
int weekday = [[calendar components:unitFlags fromDate:referenceDate] weekday] - 1;
or more likely:
NSInteger weekday = [calendar components:unitFlags fromDate:referenceDate].weekday - 1;

And for Objective C the bigger horror is that the named parameters aren't required. Just very strongly recommended. I raged at work yesterday dealing with a 3rd party that had a function like:
code:
- (void) trackEvent:(NSString*)eventTitle :(NSString*)eventValue;
and so called as [tracker trackEvent:@"This is my title" :@"This is my value];
rather than the more idiomatic [tracker trackEvent:@"This is my title" withValue:@"This is my value"];
the unnamed argument just brought me to a halt each time since it's so non-idomatic though allowable.

(rjmccall we need a clang analyzer warning for it!)

Hammerite
Mar 9, 2007

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

substitute posted:

Yes, PHP is loosely typed, so...

php:
<?
(not a function, or class)

//DEFAULTS
    $url = '';
    $prev_link = '';
    $next_link = '';
    $derp_array = array();
    $url_array = array();
    $pagination_array = array();
    $page_title = 'Derp!';
    $page_description = '';

(END not a function, or class)

?>
Thanks for letting me know that basically all your vars are empty before use... in PHP. A loosely typed language.

I'm not seeing the issue with that, or at least, I don't think the issue is what you described it as. PHP may be tolerant of using uninitialised variables, but it is still bad style to do it. Now you could argue that if some code fails to set the $page_title before creating a page then it is better for a notice about an uninitialised variable to show up during development than for the user to see a page titled "Derp!", but that's a slightly different issue.

Also, what is this called? I haven't seen it before.

php:
<?
(not a function, or class)

// ...

(END not a function, or class)

?>

Verloc
Feb 15, 2001

Note to self: Posting 'lulz' is not a good idea.

Color Gray posted:

Here's one of the best examples from mine:

code:
public string[] GetItems()
{
    try
    {
        List<string> items = new List<string>();
        items.Add("Item1");
        items.Add("Item2");
        // etc.

        return items.ToArray();
    }
    catch (Exception ex)
    {
        return null;
    }
}
:stonklol:
:golfclap: That is brilliant on so many levels. Did they have any for loops iterating over the returned string array elsewhere in the code?

nielsm
Jun 1, 2009



Hammerite posted:

Also, what is this called? I haven't seen it before.

php:
<?
(not a function, or class)

// ...

(END not a function, or class)

?>

Global scope.

Hammerite
Mar 9, 2007

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

nielsm posted:

Global scope.

No, I mean the (label) ... (END label) thing.

substitute
Aug 30, 2003

you for my mum
Yeah declaring variables is good practice, but I thought this was silly last night when I came across it in some purely procedural as all hell code. Like, I think I'll get that your array vars are arrays (since they have _array) when I scroll down. I need to stop drinking. And the post assumes everyone knows our set-up -- E_NOTICE turned off immediately.


The END thing was by habit because I see START whatever and END whatever all over the place all the time around here, in PHP, CSS, HTML.

substitute fucked around with this message at 16:18 on Apr 29, 2014

Toady
Jan 12, 2009

Hughlander posted:

And for Objective C the bigger horror is that the named parameters aren't required. Just very strongly recommended. I raged at work yesterday dealing with a 3rd party that had a function like:
code:
- (void) trackEvent:(NSString*)eventTitle :(NSString*)eventValue;
and so called as [tracker trackEvent:@"This is my title" :@"This is my value];
rather than the more idiomatic [tracker trackEvent:@"This is my title" withValue:@"This is my value"];
the unnamed argument just brought me to a halt each time since it's so non-idomatic though allowable.

(rjmccall we need a clang analyzer warning for it!)

Check out the deprecated sections of DOMDocument.h and other WebKit DOM classes.

necrotic
Aug 2, 2005
I owe my brother big time for this!

Hammerite posted:

No, I mean the (label) ... (END label) thing.

That is not part of PHP, I think he added it to show that it was in the global namespace.

substitute posted:

E_NOTICE turned off immediately.

This is the real horror.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Hughlander posted:

(rjmccall we need a clang analyzer warning for it!)

That's really more of a style-checker feature. We keep meaning to do a style checker; Google wrote most of one for us, we just need to extend it to Objective-C.

We do have a warning for the common case of doing it accidentally, i.e.:

Objective-C code:
- (void) window:(NSWindow*) didFallIntoTheSun: (NSFusionDevice*) aDevice;

substitute
Aug 30, 2003

you for my mum

necrotic posted:


This is the real horror.

Yep, but our servers would explode from the logs otherwise. I don't deal with that stuff.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Zombywuf posted:

So assuming the opposite of expression language is statement language; care to name a statement language that doesn't have warts caused by that decision?

Gonna be hard, because they all have the ternary ?: wart.

I guess the trailing-semi magic in Rust would go away if you had to explicitly say () at the end of an expression to squash to void.

code:

fn magic() -> () { thing(); }

fn explicit() -> () { thing(); () }

I'm not sure that's better, but it'd be a clearer cliché at least.

I, too, wish Graydon had held the line.

Vanadium
Jan 8, 2005

shrughes posted:

and when your for loops are actually lambdas (or was that just do blocks?)
Both of those syntactic forms went away, for-loops are now iterator based, for pattern in some_iterator { ... } and simply rewrite to some while (some_iterator.hasNext())-style thing.

QuarkJets
Sep 8, 2008

Check out this Python string:

code:
DELETE FROM my_table
WHERE id in (
    SELECT my_table.id FROM my_table
    INNER JOIN other_table ON other_table.id = my_table.remote_id
    WHERE my_table.id = %s)
This string is meant to be passed to a Python MySQLdb cursor object, so that you can just pass the id of the row that you want to delete. Well, I guess that the command ends up doing a bit more work than that, but the effect is the same

Verloc
Feb 15, 2001

Note to self: Posting 'lulz' is not a good idea.

Ithaqua posted:

Hey, look on the bright side: You learned some new stuff about Roslyn today. Might I also recommend running FxCop/Code Analysis on the application? It'll return a billion problems of varying severity (like naming convention violations), but you can configure it to suppress the less important stuff.
Thank you for your helpfulness, optimism, and PM'd Roslyn code snippets. This shop is stuck in the dark ages, but that Roslyn snippet you sent me will soon be the beating heart of a silent catch detector that'll go a long way towards keeping me from slipping off of that balance point of functional alcoholism.

While I'm on my Coding horrors bully pulpit, let's talk SCM/DevOps types. With some gentle prodding management has agreed to hire a dedicated SCM/DevOps/Release Manager type. Basically someone to help us go from 'manual builds everywhere' to well...poo poo that doesn't suck. CI, repeatable automated builds and deploys, etc. I've worked with good and bad SCM's in the past, but I'm having difficulty coalescing interview questions that'll help me quantify a good SCM vs. a bad SCM in an interview. I've been a rump SCM guy in the past, setting up CruiseControl servers, MSBuild and nAnt automation, as well as unit test plans in the past, but I'm feeling overwhelmed as far as how I can tell the difference between a douche and someone who will help us dig ourselves out of our process hole in the span of a 1 hour interview.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Verloc posted:

Thank you for your helpfulness, optimism, and PM'd Roslyn code snippets. This shop is stuck in the dark ages, but that Roslyn snippet you sent me will soon be the beating heart of a silent catch detector that'll go a long way towards keeping me from slipping off of that balance point of functional alcoholism.

While I'm on my Coding horrors bully pulpit, let's talk SCM/DevOps types. With some gentle prodding management has agreed to hire a dedicated SCM/DevOps/Release Manager type. Basically someone to help us go from 'manual builds everywhere' to well...poo poo that doesn't suck. CI, repeatable automated builds and deploys, etc. I've worked with good and bad SCM's in the past, but I'm having difficulty coalescing interview questions that'll help me quantify a good SCM vs. a bad SCM in an interview. I've been a rump SCM guy in the past, setting up CruiseControl servers, MSBuild and nAnt automation, as well as unit test plans in the past, but I'm feeling overwhelmed as far as how I can tell the difference between a douche and someone who will help us dig ourselves out of our process hole in the span of a 1 hour interview.

First problem: Hiring a "devops" guy. I've seen no compelling reason for this role. Devops is about increasing collaboration and communication between developers and infrastructure. If you need automated builds and deployments, start allocating time to do it. If you can't convince management that the time investment is worthwhile, you're already doomed.

Who's going to know how to deploy your software better than the guy who's writing it? Who's going to know about the environments that run the software better than the guy who's setting them up?

A CI build will take you, at worst, a day to get running (usually it's more like 10 minutes). Depending on the tooling you choose and how complex the deployments are, an automated release will take you a few days to get going, but after it's up and running, you'll probably barely ever have to touch it. Why is this a full-time position again?

Also, if you're not opposed to spending some money on licensing and you're already invested in MS technologies, Microsoft's release management package works beautifully.

Pythagoras a trois
Feb 19, 2004

I have a lot of points to make and I will make them later.

Ithaqua posted:

First problem: Hiring a "devops" guy. I've seen no compelling reason for this role. Devops is about increasing collaboration and communication between developers and infrastructure. If you need automated builds and deployments, start allocating time to do it. If you can't convince management that the time investment is worthwhile, you're already doomed.

Who's going to know how to deploy your software better than the guy who's writing it? Who's going to know about the environments that run the software better than the guy who's setting them up?

A CI build will take you, at worst, a day to get running (usually it's more like 10 minutes). Depending on the tooling you choose and how complex the deployments are, an automated release will take you a few days to get going, but after it's up and running, you'll probably barely ever have to touch it. Why is this a full-time position again?

Also, if you're not opposed to spending some money on licensing and you're already invested in MS technologies, Microsoft's release management package works beautifully.

Yeah, don't hire dev ops, just get yourself a Full Stack Developer.

Steve French
Sep 8, 2003

Ithaqua posted:

Who's going to know how to deploy your software better than the guy who's writing it? Who's going to know about the environments that run the software better than the guy who's setting them up?

Possibly someone with expertise and experience in deploying and managing production environments? I'm not saying he needs a dedicated devops person, but having devops responsibilities evenly distributed among developers is far from the being the ideal situation for all circumstances

revmoo
May 25, 2006

#basta
To me, the whole point of a DevOps role is that you need a person (a) Good at development and systems administration and (b) Doesn't write code so they can focus on operations instead. Having a developer be responsible for deployments is not really DevOps. If you can accomplish all of your company's goals without any dedicated DevOps personnel, then you probably don't need a DevOps team to begin with. You can do continuous deployment without a DevOps team.

The whole 'DevOps' concept is better suited to large companies that not only have a lot of infrastructure to run, but also a lot of rigidly separated departments that need walls broken down to facilitate getting poo poo done.

Zombywuf
Mar 29, 2008

Devops is about how you structure your entire company. If you have a fairly traditional setup and think you can just rub some devops on it you are going to fail.

New-ShitPost
Jul 25, 2011

Just got some new code from the India team that nobody has been reviewing for the last 3 months

code:
// TODO : Log the Error message "Unable to received response from HTTP server"
Log.Log.ModuleName(this).Error("Unable to received response from HTTP server");
:stare:

There's so much other scary poo poo in this codebase, such as using a singleton like a local variable in a web service. eg:

code:
// Reset everything to zero
ZoneInfos.InstanceZoneInfo.Zoneinfo.X = 0;
ZoneInfos.InstanceZoneInfo.Zoneinfo.Y = 0;

// Call yet another web service to fill in the values
ZoneInfos.InstanceZoneInfo.Zoneinfo.X = x;
ZoneInfos.InstanceZoneInfo.Zoneinfo.Y = y;

// Returns the results
return ZoneInfos.InstanceZoneInfo.Zoneinfo;
:stonklol:

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

You hire devops/scm/releng people not because they have generic quirks making them able to do unique tasks, but because they're *interested* in the field. So they look for ways to improve, investigate other tools and processes, willingly wear a pager, measure things, etc.

WRT interview questions, I'll try to get some examples from the FB mobile release team once they're done with F8 today (and possibly drinking for 24 hours).

qntm
Jun 17, 2009

Ithaqua posted:

A CI build will take you, at worst, a day to get running (usually it's more like 10 minutes). Depending on the tooling you choose and how complex the deployments are, an automated release will take you a few days to get going, but after it's up and running, you'll probably barely ever have to touch it. Why is this a full-time position again?

Because the last guy made a lot of blasé assumptions?

dexter
Jun 24, 2003

Ithaqua posted:

First problem: Hiring a "devops" guy. I've seen no compelling reason for this role. Devops is about increasing collaboration and communication between developers and infrastructure. If you need automated builds and deployments, start allocating time to do it. If you can't convince management that the time investment is worthwhile, you're already doomed.

Who's going to know how to deploy your software better than the guy who's writing it? Who's going to know about the environments that run the software better than the guy who's setting them up?


I don't find that to be the case at all. Most of our developers don't need to care about how applications are deployed or scaled. They're welcome to participate in those decisions / actual implementation and we absolutely encourage it (devopzzzz) but we don't require it of them. We build tooling around our infrastructure allowing them to deploy applications and services themselves so they can continue to work on their projects without being bothered with configuring CI jobs, deployment scripts, etc.

FieryBalrog
Apr 7, 2010
Grimey Drawer

QuarkJets posted:

Check out this Python string:

code:
DELETE FROM my_table
WHERE id in (
    SELECT my_table.id FROM my_table
    INNER JOIN other_table ON other_table.id = my_table.remote_id
    WHERE my_table.id = %s)
This string is meant to be passed to a Python MySQLdb cursor object, so that you can just pass the id of the row that you want to delete. Well, I guess that the command ends up doing a bit more work than that, but the effect is the same

Isn't it meant to only delete if the table row survives the join to other_table? Unless that's unnecessary or just unintended.

revmoo
May 25, 2006

#basta

dexter posted:

Most of our developers don't need to care about how applications are deployed or scaled.

Whoa, what? What kind of software do you guys build?

Edison was a dick
Apr 3, 2010

direct current :roboluv: only

Zombywuf posted:

Devops is about how you structure your entire company. If you have a fairly traditional setup and think you can just rub some devops on it you are going to fail.

Devops was invented by managers at google who didn't like 10% time, since only full developers get it and devops don't. [/cynic]

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Today's horror: most of the heap-size management code in the Android GC. Mein leben.

Verloc
Feb 15, 2001

Note to self: Posting 'lulz' is not a good idea.

revmoo posted:

The whole 'DevOps' concept is better suited to large companies that not only have a lot of infrastructure to run, but also a lot of rigidly separated departments that need walls broken down to facilitate getting poo poo done.
In a nutshell this is why we are looking. We're supporting a hilariously huge amount of infrastructure and applications for our staff size. IT and development were really really siloed and barely communicated. I've been working a lot to bring down those walls and had good success, but I've only got so much bandwidth. Having a dedicated person to handle all the necessary legwork for getting poo poo done will free me up to focus on delivering features and paying down technical debt.

Subjunctive posted:

You hire devops/scm/releng people not because they have generic quirks making them able to do unique tasks, but because they're *interested* in the field. So they look for ways to improve, investigate other tools and processes, willingly wear a pager, measure things, etc.

WRT interview questions, I'll try to get some examples from the FB mobile release team once they're done with F8 today (and possibly drinking for 24 hours).
This. Good SCM/devops people are worth their weight in gold because a year after they've automated themselves out of a job on SCM stuff they're still coming up with ways to make the developers' and sysadmins' lives easier.

dexter
Jun 24, 2003

revmoo posted:

Whoa, what? What kind of software do you guys build?

Web applications; I say most because new people working on an already deployed application don't need to care about those things. If someone's creating a new application or service then they're absolutely involved in the deployment.

Alien Arcana
Feb 14, 2012

You're related to soup, Admiral.
Found this today:

code:
try
{
	// Execute the stored procedure
	oCommand.Execute();

	operationSuccess = operationSuccess & true;
}
catch (e)
{
	// It might be a good idea to perform some real error handling here...
	operationSuccess = false;
}
Yes. Yes it might.

Edison was a dick
Apr 3, 2010

direct current :roboluv: only

Alien Arcana posted:

Found this today:

code:
try
{
	// Execute the stored procedure
	oCommand.Execute();

	operationSuccess = operationSuccess & true;
}
catch (e)
{
	// It might be a good idea to perform some real error handling here...
	operationSuccess = false;
}
Yes. Yes it might.

Heh, if this is C++ and operationSuccess is as uninitialized as I suspect it is, it's not even guaranteed to be set to true because of undefined behaviour.

shrughes
Oct 11, 2008

(call/cc call/cc)

Edison was a dick posted:

Heh, if this is C++ and operationSuccess is as uninitialized as I suspect it is, it's not even guaranteed to be set to true because of undefined behaviour.

If it were 0 that would be the case too. Presumably it's supposed to end up set to true only if several of these operations succeed.

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


$5 says operationSuccess is initialized as being true and the operation is able to silently fail without actually throwing an exception.

Edit: it's worse if there are multiple operations because you can get a case where the first fails silently (returns false but the execution succeeded so no throw) but the last succeeds so any later test you do on the value incorrectly returns true.

Powerful Two-Hander fucked around with this message at 00:29 on May 1, 2014

Adbot
ADBOT LOVES YOU

ErrantSystems
Jul 5, 2009
Hello, I've come to enforce the idea that all physics code is incomprehensible. I have tremendous respect for the people who can take a random paper and turn it into a working implementation, but I can't say that I'm at all fond of 950 line monstrosities like this.

C++ code:
// Note that this is called by a 300 line function, is part of a 4000+ line
//   source file, and itself calls a few other ~100 line functions.
double thing::physics(int i, int j, double rij[3], double rijmag,
                      double VA, double rij0[3], double rij0mag,
                      double **f, int vflag_atom)
{
  // For the curious: There are a total of 186 variables declared in 
  //   this function (luckily they've been put in one place for us to count!)
  int k,n,l /* <- loop variables */,atomk,atoml,atomn,atom1,atom2,atom3,atom4;
  int atomi,atomj,itype,jtype,ktype,ltype,ntype;
  double rik[3], rjl[3], rkn[3],rknmag,dNki;
  double NijC,NijH,NjiC,NjiH,wik,dwik,dwkn,wjl;
  double rikmag,rjlmag,cosjik,cosijl,g,tmp2,tmp3;
  double Etmp,pij,tmp,wij,dwij,NconjtmpI,NconjtmpJ;
  double Nki,Nlj,dS,lamdajik,lamdaijl,dgdc,dgdN,pji,Nijconj,piRC;
  double dcosjikdri[3],dcosijldri[3],dcosjikdrk[3];
  double dN2[2],dN3[3];
  double dcosijldrj[3],dcosijldrl[3],dcosjikdrj[3],dwjl;
  double Tij,crosskij[3],crosskijmag;
  double crossijl[3],crossijlmag,omkijl;
  double tmppij,tmppji,dN2PIJ[2],dN2PJI[2],dN3piRC[3],dN3Tij[3];
  double bij,tmp3pij,tmp3pji,Stb,dStb;
  double r32[3],r32mag,cos321;
  double om1234,rln[3];
  double rlnmag,dwln,r23[3],r23mag,r21[3],r21mag;
  double w21,dw21,r34[3],r34mag,cos234,w34,dw34;
  double cross321[3],cross234[3],prefactor,SpN;
  double fcijpc,fcikpc,fcjlpc,fcjkpc,fcilpc;
  double dt2dik[3],dt2djl[3],dt2dij[3],aa,aaa1,aaa2,at2,cw,cwnum,cwnom;
  double sin321,sin234,rr,rijrik,rijrjl,rjk2,rik2,ril2,rjl2;
  double dctik,dctjk,dctjl,dctij,dctji,dctil,rik2i,rjl2i,sink2i,sinl2i;
  double rjk[3],ril[3],dt1dik,dt1djk,dt1djl,dt1dil,dt1dij;
  double dNlj;
  double PijS,PjiS;
  double rij2,tspjik,dtsjik,tspijl,dtsijl,costmp;
  int *pair_neighs,*pair_neighs_i,*pair_neighs_j,*pair_neighs_k,*pair_neighs_l;
  double F12[3],F23[3],F34[3],F31[3],F24[3];
  double fi[3],fj[3],fk[3],fl[3],f1[3],f2[3],f3[3],f4[4];
  double rji[3],rki[3],rlj[3],r13[3],r43[3];

  double **x = atom->x;
  int *type = atom->type;

  // Trivia: there are 17 one-line comments in this function, none of them 
  //   are full sentences

  ...

  // Six hundred lines of fun

  ...

                  // Section of representative code (indentation preserved)
                  //   amazingly, they never go over 80 characters
                  dt2dij[1] = (r21[0]*cross234[2]) -
                    (r34[0]*cross321[2])-(r21[2]*cross234[0]) +
                    (r34[2]*cross321[0]);
                  dt2dij[2] = (r21[1]*cross234[0]) -
                    (r34[1]*cross321[0])-(r21[0]*cross234[1]) +
                    (r34[0]*cross321[1]);

                  aa = (prefactor*2.0*cw/cwnom)*w21*w34 *
                    (1.0-tspjik)*(1.0-tspijl);
                  aaa1 = -prefactor*(1.0-square(om1234)) *
                    (1.0-tspjik)*(1.0-tspijl);
                  aaa2 = aaa1*w21*w34;
                  at2 = aa*cwnum;

                  fcijpc = (-dt1dij*at2)+(aaa2*dtsjik*dctij*(1.0-tspijl)) +
                    (aaa2*dtsijl*dctji*(1.0-tspjik));
                  fcikpc = (-dt1dik*at2)+(aaa2*dtsjik*dctik*(1.0-tspijl));
                  fcjlpc = (-dt1djl*at2)+(aaa2*dtsijl*dctjl*(1.0-tspjik));
                  fcjkpc = (-dt1djk*at2)+(aaa2*dtsjik*dctjk*(1.0-tspijl));
                  fcilpc = (-dt1dil*at2)+(aaa2*dtsijl*dctil*(1.0-tspjik));

                  F23[0] = (fcijpc*r23[0])+(aa*dt2dij[0]);
                  F23[1] = (fcijpc*r23[1])+(aa*dt2dij[1]);
                  F23[2] = (fcijpc*r23[2])+(aa*dt2dij[2]);

  ...

  // Two hundred more lines of fun

  ...
  
                } 
              }
            }
          }
        }
      }
    }
  }

  return Stb;
}
Just in case you didn't catch on, there are 0 variable declarations past the very first block of code. Personally, my favorite variable is aaa2, although I really couldn't tell you what its supposed to represent.

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