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
tef
May 30, 2004

-> some l-system crap ->

nebby posted:

Ha ha. It's obviously even more advanced than Hungarian, it's the elusive md5(rand()) notation.

I like this scheme, it has the following advantages:

Unique names without collisions, and it sorts the naming problem once and for all. By avoiding programmer input you can avoid a lot of arguments and debate.

And of course with editor support you could link these 64 bit numbers to unicode characters to make them stand out visually.

Although you aren't encoding the type information - you avoid an english language bias. This means that it is an even playing field for people in multi-lingual environments.

You could probably have a large lookup table for each one per project, and once you start using these 64-bit numbers it will come naturally.

Adbot
ADBOT LOVES YOU

MrMoo
Sep 14, 2000

pokeyman posted:

(Did I miss anything?)

Return value seems to be undefined if string has length zero.

dwazegek
Feb 11, 2005

WE CAN USE THIS :byodood:
code:
private bool AssertPath(string p)
{
    if (Directory.Exists(p))
        return true;
    try
    {
        Directory.CreateDirectory(p);
        return true;
    }
    finally
    {
        Logging.TraceError(string.Format("Path {0} not available and unable to create.", p));
    }
}
Yeah, I don't know either :sigh:

dwazegek
Feb 11, 2005

WE CAN USE THIS :byodood:

tef posted:

You could probably have a large lookup table for each one per project, and once you start using these 64-bit numbers it will come naturally.

How about an IDE plugin that automatically translates them into something that's appealing to the reader? That way everyone can have their own crazy naming scheme without conflicts!

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

MrMoo posted:

Return value seems to be undefined if string has length zero.

It won't simply return the empty string?

MrMoo
Sep 14, 2000

pokeyman posted:

It won't simply return the empty string?

If it were C that would be a problem, I guess from your comment strings are by default valid and empty. So presumably count would default to 0 too, so no need to set it, however I saw this too:

Delphi Basics posted:

Strings are indexed with 1 for the first character (arrays start with 0 for the first element).

MrMoo fucked around with this message at 11:50 on Apr 2, 2008

EssOEss
Oct 23, 2006
128-bit approved

dwazegek posted:

code:
private bool AssertPath(string p)
{
    if (Directory.Exists(p))
        return true;
    try
    {
        Directory.CreateDirectory(p);
        return true;
    }
    finally
    {
        Logging.TraceError(string.Format("Path {0} not available and unable to create.", p));
    }
}
Yeah, I don't know either :sigh:

Seems rather obvious that the finally was actually supposed to be catch { Logging.TraceError(...); throw; }. Which is still stupid but a tiny bit more logical.

Edit: Aha! I bet I know how it happened! The author first wrote this:
code:
catch
{
Logging.TraceError(...);
}
However, the compiler gave him an error! "What is this not all code paths return a value thing? Does it not see my return statements??!? loving compiler must be broken", he thought. Lucky that he was, he remembered that sometimes a finally keyword is also used for exception handling. He was not sure what it was for but he tried using it instead of catch and noticed that the compile error went away. Hooray! "Must be a workaround for that compiler bug. I better remember that", he reasoned and went on to his next task.

EssOEss fucked around with this message at 12:45 on Apr 2, 2008

Midelne
Jun 19, 2002

I shouldn't trust the phones. They're full of gas.

nebby posted:

His input variable is named "str" and his aggregating one is named "newstring", if I try to put myself in his position, he probably said to himself, "ok, I'll name the input variable string and the output variable newstring. That makes sense. Oh, god drat it, I can't name a variable string because its one of those special colored in words. I guess I'll just call it str." Surely he did this after having the same mental exercise happen that resulted in Uppercase -> Upercase.

function Upercase(streng : string) : string;

This notation would've been far more consistent.

Victor
Jun 18, 2004
Clearly the input should be s and the output should be ret. :colbert:

Vanadium
Jan 8, 2005

Yes it should.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

nebby posted:

I mean, clearly this is generated code

it's either generated or obfuscated. Either way, it's -really- poorly done.

If it's generated, there is no reason to rely on guids for variable names - you gotta track 'em anyway, might as well give 'em decent names - especially where it bloats your code like it does in javascript.

If it's obfuscated, why didn't it obfuscate the function names?

My money is on a supershitty homemade code generator.

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Victor posted:

Clearly the input should be s and the output should be ret. :colbert:

Why not just r?

Victor
Jun 18, 2004
I reserve r for Regex instances.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Victor posted:

I reserve r for Regex instances.

hey whoa when did we get a 'fixed' tag? :krad:

6174
Dec 4, 2004

rotor posted:

hey whoa when did we get a 'fixed' tag? :krad:

http://forums.somethingawful.com/showthread.php?threadid=2809983

1337JiveTurkey
Feb 17, 2005

rotor posted:

jesus christ what the hell

Considering that it's a 128 bit number, I'm guessing he tried obfuscating things by just going through and doing a find-replace with the MD5 of all of the variable names, possibly flipping the occasional bit to make everything a valid identifier.

duck monster
Dec 15, 2004

I just found this little ripper in some code that, uh, I might of written many years ago. From memory I might not of been entirely sound of mind at the time....

code:
if ((((!(in_array($_REQUEST['context'],array(-10,-11,-12,-13)))) and ((($_SESSION['authenticated'] == 0) or ($_SESSION['authuserrole'] > 0)) or ($_REQUEST['context'] >2)))) and (!(in_array($_REQUEST['context'],array(80))))) { 
We dubbed it "ifzilla" , shortly before refactoring the poo poo out of it, once we worked out how it worked. It helped that I had written it, but I might of been a bit drunk at the time :)

A true hate crime against boolean logic.

edit: (in_array($_REQUEST['context'],array(80)) lol

duck monster fucked around with this message at 00:33 on Apr 3, 2008

Pfiffer
Feb 11, 2008

bitreaper posted:

First day on my new job, confronted with this:

INSERT INTO Applications ( Password, AccessLevel, MemberNum, MemberType, MemberExpiry, PCExpiry, AccountCreated, Title, FirstName, LastName, Gender, Lang, BirthdayMonth, BirthdayDay, BirthdayYear, HomePhone, WorkPhone, MobilePhone, FAX, Email, Street, Apartment, PostalCode, City, Province, Country, MailingSame, MailStreet, MailApartment, MailPostalCode, MailCity, MailProvince, MailCountry, Sport, Passport, , L2F, L2FMonth, L2FYear, L2FSport, L3F, L3FMonth, L3FYear, L3FSport, L4R, L4RMonth, L4RYear, L4RLocation, L4F, L4FMonth, L4FYear, L4FSport, NCID, NCIDMonth, NCIDYear, NCIDLocation, L5F, L5FMonth, L5FYear, L5FSport, Uni1Name, Uni1FromMonth, Uni1FromYear, Uni1ToMonth, Uni1ToYear, Uni1Program, Uni1Degree, Uni2Name, Uni2FromMonth, Uni2FromYear, Uni2ToMonth, Uni2ToYear, Uni2Program, Uni2Degree, Equivalence, Course1Name, Course1FromMonth, Course1FromYear, Course1ToMonth, Course1ToYear, Course1Degree, Course2Name, Course2FromMonth, Course2FromYear, Course2ToMonth, Course2ToYear, Course2Degree, WorkedGames, WorkedOlympics, WorkedParalympic, WorkedCommonwealth, WorkedPanam, WorkedCanada, International, IntAthlete, IntSeries, IntFromMonth, IntFromYear, IntToMonth, IntToYear, Emp1ActiveYear, Emp1WeekHours, Emp1YearMonths, Emp1EverFullTime, Emp1EverLocation, Emp1EverFromMonth, Emp1EverFromYear, Emp1EverToMonth, Emp1EverToYear, Emp1Name, Emp1FromMonth, Emp1FromYear, Emp1ToMonth, Emp1ToYear, Emp1Position, Emp1FullTime, Emp1Street, Emp1Apartment, Emp1City, Emp1Province, Emp1PostalCode, Emp1Contact, Emp1Phone, Emp1Income, Emp2Name, Emp2FromMonth, Emp2FromYear, Emp2ToMonth, Emp2ToYear, Emp2Position, Emp2FullTime, Emp2Street, Emp2Apartment, Emp2City, Emp2Province, Emp2PostalCode, Emp2Contact, Emp2Phone, Emp2Income, Emp3Name, Emp3FromMonth, Emp3FromYear, Emp3ToMonth, Emp3ToYear, Emp3Position, Emp3FullTime, Emp3Street, Emp3Apartment, Emp3City, Emp3Province, Emp3PostalCode, Emp3Contact, Emp3Phone, Emp3Income ) VALUES ('','member','','Associate Member','7/2/2009','3/3/2010','6/2/2008','Mr.','Fake','Fakington',0,1,0,0,0,'','','','','fake@gmail.com','','','','','','0',0,'','','','','','0','0','',0,0,0,'0',0,0,0,'0',0,0,0,'',0,0,0,'0','0',0,'0',0,0,0,0,'','',0,0,0,0,'','','',0,0,0,0,'','',0,'',0,0,0,0,'','',0,0,0,0,'',0,0,0,0,0,0,'','',0,0,0,0,'',0,0,0,0,0,'',0,0,0,0,0,0,0,'',0,'','','','','','','',0,'',0,0,0,0,'',0,'','','','','','','',0,'',0,0,0,0,'',0,'','','','','','','',0)

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ','.

Holy poo poo I laughed hard.

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Victor posted:

I reserve r for Regex instances.

Boo!

I use re for regex. It's far less common than returning a value, so it can get the extra letter.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





So that javascript monstrosity I posted? It gets better. The variable names are generated each time you load the page. That's right, they change. I'm also now in contact with the author of the 'framework' and some of the things he's said lead me to believe this is for security. To, y'know, protect the integrity of the form. Check out some of these other quotes:

quote:

...the REDACTED environment; which is hundreds of times faster than XML and totally secure

quote:

I can provide all the services of a web 2.0 environment with a great deal more efficiency

quote:

...applications are deployed on two different sites. The ‘Static’ pages as I call them...

quote:

Internet explorer’s bugs make it some pages fall apart at the larger sizes but they promise to have those fixed in version 8 which is supposed to be out this fall...

quote:

I have objections to large slow loading graphics. They waste unnecessary processing time and band width and slow down all the applications running on the server.

Also, and this is my favorite, he's using phpincludes as the storage backend.

biznatchio
Mar 31, 2001


Buglord

the talent deficit posted:

So that javascript monstrosity I posted? It gets better. The variable names are generated each time you load the page. That's right, they change. I'm also now in contact with the author of the 'framework' and some of the things he's said lead me to believe this is for security. To, y'know, protect the integrity of the form. Check out some of these other quotes:

Now that's comedy right there.

I assume the redacted environment has nothing to do with XML being just a data format.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





biznatchio posted:

Now that's comedy right there.

I assume the redacted environment has nothing to do with XML being just a data format.

The REDACTED is just the name of his framework. He keeps making bizaare comparisons. Like his framework is more secure than Apache. Except he's running it on Apache...

mracer
Feb 23, 2004
The M racer
Inside Intel's ipp mpeg2 decoder... nothing wrong with a 40+ line macro to do motion. (to add more fun they put ##stuff)
code:
#define FUNC_MC_MBLOCK_420(DIR, METH, FLG)                                               \
  Ipp8u *refY = frame_buffer.frame_p_c_n[frame_buffer.buff##DIR].Y_comp_data;            \
  Ipp8u *refU = frame_buffer.frame_p_c_n[frame_buffer.buff##DIR].U_comp_data;            \
  Ipp8u *refV = frame_buffer.frame_p_c_n[frame_buffer.buff##DIR].V_comp_data;            \
  Ipp8u *curY = video->blkCurrYUV[0];                                                    \
  Ipp8u *curU = video->blkCurrYUV[1];                                                    \
  Ipp8u *curV = video->blkCurrYUV[2];                                                    \
  Ipp32s pitch_l = frame_buffer.Y_comp_pitch;                                            \
  Ipp32s pitch_c = frame_buffer.U_comp_pitch;                                            \
  Ipp32s flag_l, flag_c;                                                                 \
  Ipp32s offs_l, offs_c;                                                                 \
  Ipp16s vec_x, vec_y;                                                                   \
                                                                                         \
  if(video->prediction_type == IPPVC_MC_FRAME)                                           \
  {                                                                                      \
    DECODE_MV(video->bs, index##DIR, index##DIR, vec_x, vec_y);                          \
    video->PMV[index##DIR + 4] = video->PMV[index##DIR];                                 \
    video->PMV[index##DIR + 5] = video->PMV[index##DIR + 1];                             \
	video->trans_output->g_transmb[sequenceHeader.mb_width*video->mb_row+video->mb_col].mvfx=vec_x; \
	video->trans_output->g_transmb[sequenceHeader.mb_width*video->mb_row+video->mb_col].mvfy=vec_y; \
                                                                                         \
    CALC_OFFSETS_FRAME_420(offs_l, offs_c, flag_l, flag_c, vec_x, vec_y, HP_FLAG_##FLG)  \
    CHECK_OFFSET_L(offs_l+(vec_x&1), pitch_l, 16+(vec_y&1))                              \
                                                                                         \
    FUNC_##METH##_HP(16, 16, refY + offs_l, pitch_l, curY, pitch_l, flag_l, 0);          \
    FUNC_##METH##_HP(8,  8,  refU + offs_c, pitch_c, curU, pitch_c, flag_c, 0);          \
    FUNC_##METH##_HP(8,  8,  refV + offs_c, pitch_c, curV, pitch_c, flag_c, 0);          \
  }                                                                                      \
  else                                                                                   \
  {                                                                                      \
    Ipp32s pitch_l2 = pitch_l + pitch_l;                                                 \
    Ipp32s pitch_c2 = pitch_c + pitch_c;                                                 \
    Ipp32s field_sel0, field_sel1;                                                       \
    Ipp16s vec1_x, vec1_y;                                                               \
                                                                                         \
    GET_1BIT(video->bs, field_sel0);                                                     \
    DECODE_MV_FIELD(video->bs, index##DIR, index##DIR, vec_x, vec_y);                    \
    GET_1BIT(video->bs, field_sel1);                                                     \
    DECODE_MV_FIELD(video->bs, index##DIR + 4, index##DIR, vec1_x, vec1_y);              \
	video->trans_output->g_transmb[sequenceHeader.mb_width*video->mb_row+video->mb_col].mvfx=vec_x; \
	video->trans_output->g_transmb[sequenceHeader.mb_width*video->mb_row+video->mb_col].mvfy=vec_y; \
                                                                                                  \
    CALC_OFFSETS_FIELD_420(offs_l, offs_c, flag_l, flag_c, vec_x, vec_y, field_sel0, HP_FLAG_##FLG)   \
    CHECK_OFFSET_L(offs_l+(vec_x&1), pitch_l2, 8+(vec_y&1))                                       \
                                                                                                  \
    FUNC_##METH##_HP(16, 8, refY + offs_l, pitch_l2, curY, pitch_l2, flag_l, 0);                  \
    FUNC_##METH##_HP(8,  4, refU + offs_c, pitch_c2, curU, pitch_c2, flag_c, 0);                  \
    FUNC_##METH##_HP(8,  4, refV + offs_c, pitch_c2, curV, pitch_c2, flag_c, 0);                  \
                                                                                                  \
    CALC_OFFSETS_FIELD_420(offs_l, offs_c, flag_l, flag_c, vec1_x, vec1_y, field_sel1, HP_FLAG_##FLG) \
    CHECK_OFFSET_L(offs_l+(vec1_x&1), pitch_l2, 8+(vec1_y&1))                                     \
                                                                                                  \
    FUNC_##METH##_HP(16, 8, refY + offs_l, pitch_l2, curY + pitch_l, pitch_l2, flag_l, 0);        \
    FUNC_##METH##_HP(8,  4, refU + offs_c, pitch_c2, curU + pitch_c, pitch_c2, flag_c, 0);        \
    FUNC_##METH##_HP(8,  4, refV + offs_c, pitch_c2, curV + pitch_c, pitch_c2, flag_c, 0);        \
}                                                                                               \
  return UMC_OK

mracer fucked around with this message at 13:55 on Apr 3, 2008

mantaworks
May 6, 2005

by Fragmaster
I love meth too.

fansipans
Nov 20, 2005

Internets. Serious Business.

the talent deficit posted:

So that javascript monstrosity I posted? It gets better. The variable names are generated each time you load the page. That's right, they change. I'm also now in contact with the author of the 'framework' and some of the things he's said lead me to believe this is for security. To, y'know, protect the integrity of the form. Check out some of these other quotes:

Also, and this is my favorite, he's using phpincludes as the storage backend.

:barf:

Warning, pissy rant ahead!

I never cease to be amazed at how people so ignorant can think themselves to be so loving smart. Also, the older I get, the more I want to physically assault programmers who inflict "cute", "awesome", "ingenious" or "brilliant" solutions like these - that are used by no other major framework/application - without considering the hurdles in maintenance, debugging, and overall (OVERALL) security. If you're coming up with cute JavaScript shenanigans at the coffee shop - don't loving integrate them into production systems that other people will have to deal with.

The fantabulous thing about the Interwebs is you do have an opportunity to write new code, to do something nobody's ever done before. But jesus tittyfucking christ, do these things on your own time, blog about them, propose them as additions to open source projects that can benefit from them. If they're good they'll take off! Don't just slam them into any code that people rely on!

Lexical Unit
Sep 16, 2003

Saw this today:
code:
	void Foo(string src)
	{
//  //			printf ("debung bullshit blah blah....\n",
//				stuff, things);
//	old_code = left::behind;
		Bar b;
		b.name = src;
		map<string, Bar>::iterator it=Bars.find(src);
		if(it==Bars.end())
		//if(it!=Bars.end())
		  Bars.insert(pair<string, Bar>(src, b));
		else (*it).second=b;
	DEBUG_PRINT("Poo pants!");
	}
Mixing tabs and spaces for code indention, check. Commented out lines twice, for good measure, check. Old as hell left over code all over the place but commented out, check. Besides all that, why -- when this would have sufficed:
code:
void Foo(string src)
{
	Bars[src] = Bar (src);
}

That Turkey Story
Mar 30, 2003

Victor posted:

Clearly, return is a function. :psyduck:

A little side story -- I've seen someone do this before when he was first learning to program and when I told him that he didn't need the parenthesis because return is not a function, he said that he was using the parenthesis not because he thought it was a function but because he wasn't sure of the order of operations. For instance, he thought return 1 + 3; might return the value 1 and then the rest of the expression was evaluated "after the return" and therefore not affecting the return value (in other words he thought return 1 + 3 could potentially behave something like (return 1) + 3 where "return 1" returned the value 1 and had a value in the encapsulating expression of 1). I was kind of puzzled for a second, but I was actually sort of impressed when I heard his rationale since it showed both that he questioned the effect of a type of return statement he had never seen before, as up until then he probably had only seen 1 term return statements, and he also realized that by using parenthesis there he could more safely assume the result that he wanted. He is now actually a very good programmer!

Of course, that was someone who had only just started programming a week before, so he had an excuse to not know the behavior, and if I saw any experienced programmer doing it I'd definitely be a little bit more baffled (though honestly who really cares, some extra parenthesis never hurt anyone).

duck monster
Dec 15, 2004

Surge Strip posted:

Our intern programmer makes me laugh some days. For example, he future proofed all his code, just in case the definition for a newline ever changes on Windows:

code:
CRLF := #13 + #10;
He codes mostly in Delphi, which has quite a few functions for you to use. I guess he just didn't like the Uppercase function they wrote:

code:
function Upercase(str : string) : string;
   var
   len : integer;
   count : integer;
   newstring : string;
   begin
   len := length(str);
   count := 0;
   while (count < len) do
      begin
      newstring[count] := str[count] - 32;
      count := count + 1;
      end;
   result := newstring;
   end;
So many things wrong. He even got an error that Uppercase was already defined, and so he misspelled it.

When you consider that pascals unparallelled strongpoint is set mathematics, that example is even looper than you'd imagine. You can write a flawless uppercase function in a 4 lines of code, including the "function" "begin" and the "end" lines.

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

That Turkey Story posted:

(in other words he thought return 1 + 3 could potentially behave something like (return 1) + 3 where "return 1" returned the value 1 and had a value in the encapsulating expression of 1)

In Haskell, this is broadly how the order of operations actually works, because return is actually a value-lifting monad constructor function and function application has higher precedence than any infix operator.

Lexical Unit
Sep 16, 2003

Victor posted:

Clearly, return is a function. :psyduck:
Sometimes I'll do this like if I'm returning a the boolean value of an expression or using ?: or something, just to bring attention to it. So like return (foo ? "foo" : "not foo"); or return (a && (b || c));. I don't know, it also looks somehow cleaner to my mind. V:shobon:V

_aaron
Jul 24, 2007
The underscore is silent.

Lexical Unit posted:

Sometimes I'll do this like if I'm returning a the boolean value of an expression or using ?: or something, just to bring attention to it. So like return (foo ? "foo" : "not foo"); or return (a && (b || c));. I don't know, it also looks somehow cleaner to my mind. V:shobon:V
These types of things are fine, and I would say almost encouraged, because it really helps with readability. But if you write return (x);, what readability is gained here vs. return x;?

Lexical Unit
Sep 16, 2003

Nada, I agree there.

blorpy
Jan 5, 2005

But maybe after the program pops off the stack and returns to the other function it'll get bored or something and come back to it and evaluate the rest of the statement!!!

chocojosh
Jun 9, 2007

D00D.

That Turkey Story posted:

A little side story -- I've seen someone do this before when he was first learning to program and when I told him that he didn't need the parenthesis because return is not a function, he said that he was using the parenthesis not because he thought it was a function but because he wasn't sure of the order of operations. For instance, he thought return 1 + 3; might return the value 1 and then the rest of the expression was evaluated "after the return" and therefore not affecting the return value (in other words he thought return 1 + 3 could potentially behave something like (return 1) + 3 where "return 1" returned the value 1 and had a value in the encapsulating expression of 1). I was kind of puzzled for a second, but I was actually sort of impressed when I heard his rationale since it showed both that he questioned the effect of a type of return statement he had never seen before, as up until then he probably had only seen 1 term return statements, and he also realized that by using parenthesis there he could more safely assume the result that he wanted. He is now actually a very good programmer!

Of course, that was someone who had only just started programming a week before, so he had an excuse to not know the behavior, and if I saw any experienced programmer doing it I'd definitely be a little bit more baffled (though honestly who really cares, some extra parenthesis never hurt anyone).

I sometimes put the return expression in parenthesis simply because I find it more readable. Is that really a coding horror? :)

necrobobsledder
Mar 21, 2005
Lay down your soul to the gods rock 'n roll
Nap Ghost

ShoulderDaemon posted:

In Haskell, this is broadly how the order of operations actually works, because return is actually a value-lifting monad constructor function and function application has higher precedence than any infix operator.
I had a habit of this in C because of this reason. Under some old, buggy compilers (that I had to support and code for with extremely stringent coding standards) some genius managed to place the precedent of specifically the return keyword to be higher than that of other operations. And the compiler was no longer being supported... by anyone. Standards, who cares about standards, right?

Working on proprietary legacy software has made me code with such paranoia about the compiler loving up now that I'm not sure if I can ever be as fast as I used to be.

zootm
Aug 8, 2006

We used to be better friends.

chocojosh posted:

I sometimes put the return expression in parenthesis simply because I find it more readable. Is that really a coding horror? :)
Like (return 1 + 2); or return (1 + 2);? I think in C-like languages I'd regard the former as something of a coding horror simply because it's so unusual that I wouldn't even know if it worked. Really strange.

chocojosh
Jun 9, 2007

D00D.

zootm posted:

Like (return 1 + 2); or return (1 + 2);? I think in C-like languages I'd regard the former as something of a coding horror simply because it's so unusual that I wouldn't even know if it worked. Really strange.

The latter. Note that I don't think I've ever done return (retVal); but I will do things like return (x + 10); or return (x > 0)

Vanadium
Jan 8, 2005

There is at least one C-inspired language that requires that return is used like a function with parentheses and all, as far as I can tell it is mostly because the compiler guy could not be bothered to specialcase return's syntax. :shobon:

zootm
Aug 8, 2006

We used to be better friends.

chocojosh posted:

The latter. Note that I don't think I've ever done return (retVal); but I will do things like return (x + 10); or return (x > 0)
There's no problem at all with that, it was the other thing that'd confuse me. :)

Adbot
ADBOT LOVES YOU

Victor
Jun 18, 2004

TRex EaterofCars posted:

Boo!

I use re for regex. It's far less common than returning a value, so it can get the extra letter.
Hrm, you might have just started to convert me from ret to r. Nobody tell nebby!

That Turkey Story posted:

he said that he was using the parenthesis not because he thought it was a function but because he wasn't sure of the order of operations.
Cool, I approve of this. It sounds like this guy does something extremely rare -- it seems like he actually tries to be aware of what he doesn't know!

quote:

(though honestly who really cares, some extra parenthesis never hurt anyone).
I'm one of those guys who doesn't want extraneous information screwing with my precious brain cycles.

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