Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Equates or Synonyms?

Reply
Thread Tools

Equates or Synonyms?

 
 
Mike Copeland
Guest
Posts: n/a
 
      11-29-2011
In article <(E-Mail Removed)>, http://www.velocityreviews.com/forums/(E-Mail Removed)
says...
> >>>> Why do you want a different name when you're not using it?
> >>>> The simplest solution is then to ignore the name.
> >>>> After all, you're not using it.
> >>>
> >>> I only want to use a more descriptive name for the variable in the
> >>> application code. I want to maintain _some_ level of useful
> >>> documentation in my code...
> >>
> >> Then don't bother with the name of type, just give the variable a better
> >> name. Try "eventMaximumPace" rather than "EPace". Also heed Alf's
> >> advice about mixing naming convections!

> >
> > That's one reason why I want this capability: I know the name isn't
> > "good", but I have any applications where it's in my code but I want to
> > gradually migrate to the better name. Some of these applications are
> > old and don't need updates right now, so I'd leave them alone for a
> > while while I work on current stuff...

>
> Being somewhat lazy these days, I'd just load up the projects in my
> current IDE and select refactor->rename. Job done.

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Huh? What is this? I've never seen or heard of any such "IDE
capability" (of course, I use VS6.0, which everyone constantly tells me
it sucks...). <sigh...>
 
Reply With Quote
 
 
 
 
Ian Collins
Guest
Posts: n/a
 
      11-29-2011
On 11/29/11 06:00 PM, Mike Copeland wrote:
> In article<(E-Mail Removed)>, (E-Mail Removed)
> says...
>>>>>> Why do you want a different name when you're not using it?
>>>>>> The simplest solution is then to ignore the name.
>>>>>> After all, you're not using it.
>>>>>
>>>>> I only want to use a more descriptive name for the variable in the
>>>>> application code. I want to maintain _some_ level of useful
>>>>> documentation in my code...
>>>>
>>>> Then don't bother with the name of type, just give the variable a better
>>>> name. Try "eventMaximumPace" rather than "EPace". Also heed Alf's
>>>> advice about mixing naming convections!
>>>
>>> That's one reason why I want this capability: I know the name isn't
>>> "good", but I have any applications where it's in my code but I want to
>>> gradually migrate to the better name. Some of these applications are
>>> old and don't need updates right now, so I'd leave them alone for a
>>> while while I work on current stuff...

>>
>> Being somewhat lazy these days, I'd just load up the projects in my
>> current IDE and select refactor->rename. Job done.

> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Huh? What is this? I've never seen or heard of any such "IDE
> capability" (of course, I use VS6.0, which everyone constantly tells me
> it sucks...).<sigh...>



It's a feature of NetBeans and I assume Eclipse as well.

All copes of VS6.0 should have self destructed many, many years ago!

--
Ian Collins
 
Reply With Quote
 
 
 
 
ralph
Guest
Posts: n/a
 
      11-29-2011
On Mon, 28 Nov 2011 22:00:06 -0700, (E-Mail Removed) (Mike Copeland)
wrote:

>In article <(E-Mail Removed)>, (E-Mail Removed)
>says...
>> >>>> Why do you want a different name when you're not using it?
>> >>>> The simplest solution is then to ignore the name.
>> >>>> After all, you're not using it.
>> >>>
>> >>> I only want to use a more descriptive name for the variable in the
>> >>> application code. I want to maintain _some_ level of useful
>> >>> documentation in my code...
>> >>
>> >> Then don't bother with the name of type, just give the variable a better
>> >> name. Try "eventMaximumPace" rather than "EPace". Also heed Alf's
>> >> advice about mixing naming convections!
>> >
>> > That's one reason why I want this capability: I know the name isn't
>> > "good", but I have any applications where it's in my code but I want to
>> > gradually migrate to the better name. Some of these applications are
>> > old and don't need updates right now, so I'd leave them alone for a
>> > while while I work on current stuff...

>>
>> Being somewhat lazy these days, I'd just load up the projects in my
>> current IDE and select refactor->rename. Job done.

> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Huh? What is this? I've never seen or heard of any such "IDE
>capability" (of course, I use VS6.0, which everyone constantly tells me
>it sucks...). <sigh...>


Visual Studio, out-of-the-box, only supports the Refactor! option for
VB.Net and C#. However, Microsoft offers a Refactor Plug-In for VC++
you can download at ...
http://msdn.microsoft.com/en-us/vstudio/bb737896

Worth a look.

-ralph
 
Reply With Quote
 
Kalle Olavi Niemitalo
Guest
Posts: n/a
 
      11-29-2011
(E-Mail Removed) (Mike Copeland) writes:

> Thus, I want the structure object to be initialized (by common
> processing), but I want to manipulate some of the data fields (with
> better names) uniquely in some new programs. Specifically, I want to
> use some of the "int" variables as counters for special application(s),
> knowing that their normal usage isn't being applied in the new program
> (s). Hence, I'd like to use better, more descriptive names there...


Could you use anonymous unions for that?

struct DEF_STRUCT
{
union
{
int EPace; // event maximum pace
int CounterForSpecialApplication;
};
int TFCount; // Total Finishers Counts
short ADepth; // Awards Depth
short SFMales, SFFemales; // Skipped Finishers
unsigned short dbeMales, dbeFemales;
unsigned short finMales, finFemales;
unsigned short prtMales, prtFemales;
float EDist; // event distance in miles
[etc.]
} ;
 
Reply With Quote
 
Jorgen Grahn
Guest
Posts: n/a
 
      11-29-2011
On Tue, 2011-11-29, Mike Copeland wrote:
> In article <(E-Mail Removed)>, (E-Mail Removed)
> says...
>> >>>> Why do you want a different name when you're not using it?
>> >>>> The simplest solution is then to ignore the name.
>> >>>> After all, you're not using it.
>> >>>
>> >>> I only want to use a more descriptive name for the variable in the
>> >>> application code. I want to maintain _some_ level of useful
>> >>> documentation in my code...
>> >>
>> >> Then don't bother with the name of type, just give the variable a better
>> >> name. Try "eventMaximumPace" rather than "EPace". Also heed Alf's
>> >> advice about mixing naming convections!
>> >
>> > That's one reason why I want this capability: I know the name isn't
>> > "good", but I have any applications where it's in my code but I want to
>> > gradually migrate to the better name. Some of these applications are
>> > old and don't need updates right now, so I'd leave them alone for a
>> > while while I work on current stuff...

>>
>> Being somewhat lazy these days, I'd just load up the projects in my
>> current IDE and select refactor->rename. Job done.

> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Huh? What is this? I've never seen or heard of any such "IDE
> capability" (of course, I use VS6.0, which everyone constantly tells me
> it sucks...). <sigh...>


In cases like this, it doesn't matter that your IDE sucks. If you
rename the definition of the struct member, the compiler will check
that you've renamed the uses correctly. A Perl one-liner or similar
can do the actual renaming.

The rest is a matter of management, e.g. being allowed to make trivial
changes to a stable application, being allowed to argue that these
changes are safe without a month of testing, and being able to postpone
delivery to users until some vital (to the users) change comes along.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple equates jzakiya Python 27 12-04-2008 07:21 PM
Refilling your printer cartridges now equates to committing a crime? XP NZ Computing 8 09-17-2005 03:55 AM
Does Perl have anything that equates to the C++ this pointer? Calvin Perl 2 08-01-2004 08:55 PM



Advertisments