Programming Convention Survey of the day
-
Phil Martin... wrote:
I were in C (and not C++)
I think you mean: int obj_rec_n_cpy(void*, void*, int);
¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog
Nope, I don't think I meant that.
-
I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named
CopyObjectArrayToRecord
, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, arrayCo-Author ASP.NET AJAX in Action
-
I also agree with 1
-
I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named
CopyObjectArrayToRecord
, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, arrayCo-Author ASP.NET AJAX in Action
-
I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named
CopyObjectArrayToRecord
, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, arrayCo-Author ASP.NET AJAX in Action
-
This convention actually drives me crazy...it should be from left to right to keep the flow natural...assembly language does it like that: MOV dst, src ...no wonder nobody uses it. It's like reading a sentence that you have to start at the beginning, then jump to the end and read back to the middle...an unnecessary direction change. :~
David Lockwood wrote:
It's like reading a sentence that you have to start at the beginning, then jump to the end and read back to the middle.
Something like German? ;P
[My Blog]
"Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe -
I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named
CopyObjectArrayToRecord
, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, arrayCo-Author ASP.NET AJAX in Action
1 is logical.
'--8<------------------------ Ex Datis: Duncan Jones Merrion Computing Ltd
-
WEllllll, for a modern language, I would expect CopyObjectArrayToRecord(object[], record) But, if I were in C (and not C++), I would fully expect it to be CopyObjectArrayToRecord(record*, object*), or more likely objrecncpy :) - Phil
-
I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named
CopyObjectArrayToRecord
, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, arrayCo-Author ASP.NET AJAX in Action
2 of course because I was brought up on K&R and PDP architecture. I'm told being left handed also helps :-D ~A
-
I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named
CopyObjectArrayToRecord
, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, arrayCo-Author ASP.NET AJAX in Action
-
I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named
CopyObjectArrayToRecord
, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, arrayCo-Author ASP.NET AJAX in Action
Logic says 1 But I would presume from your question that this may not be the case! What has logic to do with programming?
------------------------------------ Happy Primes Lead to Happy Memories. Don't Google FGI
-
This convention actually drives me crazy...it should be from left to right to keep the flow natural...assembly language does it like that: MOV dst, src ...no wonder nobody uses it. It's like reading a sentence that you have to start at the beginning, then jump to the end and read back to the middle...an unnecessary direction change. :~
David Lockwood wrote:
assembly language does it like that:
Not all. One of the stark differences between the Intel processors and the Motorola processors was the src/dest order. Marc
-
I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named
CopyObjectArrayToRecord
, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, arrayCo-Author ASP.NET AJAX in Action
First. It makes more sense. Carlos
Carlos Mariano
-
Bah! Madness!
record.AddCopyOfObjectArray(array)
every night, i kneel at the foot of my bed and thank the Great Overseeing Politicians for protecting my freedoms by reducing their number, as if they were deer in a state park. -- Chris Losinger, Online Poker Players?
#1 makes more sense to me, too...:cool:
C. Durand Sr. Programmer/Analyst
-
I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named
CopyObjectArrayToRecord
, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, arrayCo-Author ASP.NET AJAX in Action
I'd say 1. Generally speaking, I'd adhere to that logic. Also, I believe that it is common in copy methods to organize parameters as (source, destination).
Life should NOT be a journey to the grave with the intention of arriving safely in an attractive and well preserved body, but rather to skid in sideways, burger in one hand, drink in the other, body thoroughly used up, totally worn out and screaming "WOO HOO......What a ride!"
-
I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named
CopyObjectArrayToRecord
, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, arrayCo-Author ASP.NET AJAX in Action
-
I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named
CopyObjectArrayToRecord
, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, arrayCo-Author ASP.NET AJAX in Action
#1 seems the most logical. If you renamed it CopyToRecordFromObjectArray, then #2. Peace
-
Well, bucking the trend (as usual), whatever it's called, I would expect the destination (target) object to be the first parameter. So, #2! :-D [edit]And sadly, in C#, Array.Copy takes the source array as the first parameter. Which leads me to end of teeth gnashing because I liked the platform SDK's consistency of having the destination as the first parameter, such as in the BitBlt function or, in the C/C++ language, another example is the memcpy function. So, here's another perfect example of how the designers of C# BLEW IT!!![/edit] Marc
Marc Clifton wrote:
Well, bucking the trend (as usual), whatever it's called, I would expect the destination (target) object to be the first parameter. So, #2!
That's my instinctive reaction too. We've mentally been so used to the destinatioin being the left argument. MOV ax, 9 strcpy(dest,"...") But one subtle difference in Rama's function name is that, it goes slike this :- CopyXtoY(X src_x , Y dest_y) : so here the order actually makes sense . Buthad it been Copy(Y dest_y, X src_x) : then this makes better sense.
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com link -
2 of course because I was brought up on K&R and PDP architecture. I'm told being left handed also helps :-D ~A
PIP for the win!