public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Does g++ have a intel/msdn __COUNTER__ macro equivalent??
@ 2007-09-04 10:26 me
  2007-09-04 10:47 ` Dave Korn
  0 siblings, 1 reply; 11+ messages in thread
From: me @ 2007-09-04 10:26 UTC (permalink / raw)
  To: gcc

Dear Sir/Madam
I'm trying to specify random distributions throughout my program eg
Uniform(1,0), Normal(10,2). 

Id like these replaced at the pre-processing stage with
Uniform(__COUNTER__,1,0) & Normal(__COUNTER__,10,2) using macros such as
#define U(a,b) U(__COUNTER__,a,b) etc

The point of this is that __COUNTER__ would assign consecutive numbers
representing the index of the random number generator to be used.

Here is a description of Microsoft's version of __COUNTER__ &
I believe that Intel also has such a facility.
========================================================================
Expands to an integer starting with 0 and incrementing by 1 every time
it is used in a compiland. __COUNTER__ remembers its state when using
precompiled headers. If the last __COUNTER__ value was 4 after building
a precompiled header (PCH), it will start with 5 on each PCH use.

__COUNTER__ lets you generate unique variable names. You can use token
pasting with a prefix to make a unique name. For example:

// pre_mac_counter.cpp
#include <stdio.h>
#define FUNC2(x,y) x##y
#define FUNC1(x,y) FUNC2(x,y)
#define FUNC(x) FUNC1(x,__COUNTER__)

int FUNC(my_unique_prefix);
int FUNC(my_unique_prefix);

int main() {
   my_unique_prefix0 = 0;
   printf_s("\n%d",my_unique_prefix0);
   my_unique_prefix0++;
   printf_s("\n%d",my_unique_prefix0);
}
========================================================================

I can not find g++'s equivalent & wonder how I could achieve the same
thing?

Your consideration of this matter is much appreciated.
Best Rgds
Dean


^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Does g++ have a intel/msdn __COUNTER__ macro equivalent??
  2007-09-04 10:26 Does g++ have a intel/msdn __COUNTER__ macro equivalent?? me
@ 2007-09-04 10:47 ` Dave Korn
  2007-09-09 14:39   ` Gerald Pfeifer
  0 siblings, 1 reply; 11+ messages in thread
From: Dave Korn @ 2007-09-04 10:47 UTC (permalink / raw)
  To: 'me', gcc

On 04 September 2007 10:05, me wrote:

> The point of this is that __COUNTER__ would assign consecutive numbers

> I can not find g++'s equivalent & wonder how I could achieve the same
> thing?

  This feature was just added recently.  It will be in all upcoming gcc-4.3
and later series releases.  See 
http://gcc.gnu.org/ml/gcc-patches/2007-05/msg01579.html



    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Does g++ have a intel/msdn __COUNTER__ macro equivalent??
  2007-09-04 10:47 ` Dave Korn
@ 2007-09-09 14:39   ` Gerald Pfeifer
  2007-09-11 20:14     ` Ollie Wild
  0 siblings, 1 reply; 11+ messages in thread
From: Gerald Pfeifer @ 2007-09-09 14:39 UTC (permalink / raw)
  To: Dave Korn, Ollie Wild; +Cc: mgbg25171, gcc

On Tue, 4 Sep 2007, Dave Korn wrote:
> On 04 September 2007 10:05, me wrote:
>> The point of this is that __COUNTER__ would assign consecutive numbers
>
>> I can not find g++'s equivalent & wonder how I could achieve the same
>> thing?
> This feature was just added recently.  It will be in all upcoming gcc-4.3
> and later series releases.  See 
> http://gcc.gnu.org/ml/gcc-patches/2007-05/msg01579.html

Hmm, I just noticed that we do not indicate so in our release notes, 
though.

Ollie, would you mind adding a snippet to htdocs/gcc-4.3/changes.html
in the wwwdocs module of our CVS repository?  If you need any help with
that, please let me know.

Gerald

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Does g++ have a intel/msdn __COUNTER__ macro equivalent??
  2007-09-09 14:39   ` Gerald Pfeifer
@ 2007-09-11 20:14     ` Ollie Wild
  2007-09-11 20:58       ` Tom Tromey
  0 siblings, 1 reply; 11+ messages in thread
From: Ollie Wild @ 2007-09-11 20:14 UTC (permalink / raw)
  To: Gerald Pfeifer; +Cc: Dave Korn, mgbg25171, gcc

On 9/9/07, Gerald Pfeifer <gerald@pfeifer.com> wrote:
> Ollie, would you mind adding a snippet to htdocs/gcc-4.3/changes.html
> in the wwwdocs module of our CVS repository?  If you need any help with
> that, please let me know.

Sent to gcc-patches at
http://gcc.gnu.org/ml/gcc-patches/2007-09/msg01017.html.  Please
review.

Also, I recently added a new -fdirectives-only option which improves
distcc and ccache performance.  Does that merit a release note update
as well?

Ollie

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Does g++ have a intel/msdn __COUNTER__ macro equivalent??
  2007-09-11 20:14     ` Ollie Wild
@ 2007-09-11 20:58       ` Tom Tromey
  2007-09-11 21:10         ` Gerald Pfeifer
  0 siblings, 1 reply; 11+ messages in thread
From: Tom Tromey @ 2007-09-11 20:58 UTC (permalink / raw)
  To: Ollie Wild; +Cc: Gerald Pfeifer, Dave Korn, mgbg25171, gcc

>>>>> "Ollie" == Ollie Wild <aaw@google.com> writes:

Ollie> Also, I recently added a new -fdirectives-only option which improves
Ollie> distcc and ccache performance.  Does that merit a release note update
Ollie> as well?

IMO, yes.

Tom

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Does g++ have a intel/msdn __COUNTER__ macro equivalent??
  2007-09-11 20:58       ` Tom Tromey
@ 2007-09-11 21:10         ` Gerald Pfeifer
  2007-09-11 22:41           ` Ollie Wild
  0 siblings, 1 reply; 11+ messages in thread
From: Gerald Pfeifer @ 2007-09-11 21:10 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Ollie Wild, Dave Korn, mgbg25171, gcc

On Tue, 11 Sep 2007, Tom Tromey wrote:
>> Also, I recently added a new -fdirectives-only option which improves
>> distcc and ccache performance.  Does that merit a release note update
> as well?
> IMO, yes.

Seconded. :-)

Gerald

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Does g++ have a intel/msdn __COUNTER__ macro equivalent??
  2007-09-11 21:10         ` Gerald Pfeifer
@ 2007-09-11 22:41           ` Ollie Wild
  2007-09-13 16:00             ` Tom Tromey
  0 siblings, 1 reply; 11+ messages in thread
From: Ollie Wild @ 2007-09-11 22:41 UTC (permalink / raw)
  To: Gerald Pfeifer; +Cc: Tom Tromey, Dave Korn, mgbg25171, gcc

On 9/11/07, Gerald Pfeifer <gerald@pfeifer.com> wrote:
> On Tue, 11 Sep 2007, Tom Tromey wrote:
> >> Also, I recently added a new -fdirectives-only option which improves
> >> distcc and ccache performance.  Does that merit a release note update
> > as well?
> > IMO, yes.
>
> Seconded. :-)

OK.  I'll add a blurb for -fdirectives-only as well.

One quick question.  When I updated the gcc info page, Mark Mitchell
felt strongly that it shouldn't mention distcc or ccache directly.
However, I think it's a good idea to give users some idea what the
option is good for.  Is it appropriate to mention these applications
in the release notes?

Ollie

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Does g++ have a intel/msdn __COUNTER__ macro equivalent??
  2007-09-11 22:41           ` Ollie Wild
@ 2007-09-13 16:00             ` Tom Tromey
  2007-09-13 22:29               ` Ollie Wild
  0 siblings, 1 reply; 11+ messages in thread
From: Tom Tromey @ 2007-09-13 16:00 UTC (permalink / raw)
  To: Ollie Wild; +Cc: Gerald Pfeifer, Dave Korn, mgbg25171, gcc

>>>>> "Ollie" == Ollie Wild <aaw@google.com> writes:

Ollie> One quick question.  When I updated the gcc info page, Mark
Ollie> Mitchell felt strongly that it shouldn't mention distcc or
Ollie> ccache directly.  However, I think it's a good idea to give
Ollie> users some idea what the option is good for.  Is it appropriate
Ollie> to mention these applications in the release notes?

I think it makes sense, but I wonder what Mark's objection was.

Tom

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Does g++ have a intel/msdn __COUNTER__ macro equivalent??
  2007-09-13 16:00             ` Tom Tromey
@ 2007-09-13 22:29               ` Ollie Wild
  2007-09-13 22:33                 ` Mark Mitchell
  0 siblings, 1 reply; 11+ messages in thread
From: Ollie Wild @ 2007-09-13 22:29 UTC (permalink / raw)
  To: tromey, Mark Mitchell; +Cc: Gerald Pfeifer, Dave Korn, mgbg25171, gcc

On 9/13/07, Tom Tromey <tromey@redhat.com> wrote:
> >>>>> "Ollie" == Ollie Wild <aaw@google.com> writes:
>
> Ollie> One quick question.  When I updated the gcc info page, Mark
> Ollie> Mitchell felt strongly that it shouldn't mention distcc or
> Ollie> ccache directly.  However, I think it's a good idea to give
> Ollie> users some idea what the option is good for.  Is it appropriate
> Ollie> to mention these applications in the release notes?
>
> I think it makes sense, but I wonder what Mark's objection was.

Mark, would you like to comment?

Ollie

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Does g++ have a intel/msdn __COUNTER__ macro equivalent??
  2007-09-13 22:29               ` Ollie Wild
@ 2007-09-13 22:33                 ` Mark Mitchell
  2007-09-13 22:56                   ` Ollie Wild
  0 siblings, 1 reply; 11+ messages in thread
From: Mark Mitchell @ 2007-09-13 22:33 UTC (permalink / raw)
  To: Ollie Wild; +Cc: tromey, Gerald Pfeifer, Dave Korn, mgbg25171, gcc

Ollie Wild wrote:
> On 9/13/07, Tom Tromey <tromey@redhat.com> wrote:
>>>>>>> "Ollie" == Ollie Wild <aaw@google.com> writes:
>> Ollie> One quick question.  When I updated the gcc info page, Mark
>> Ollie> Mitchell felt strongly that it shouldn't mention distcc or
>> Ollie> ccache directly.  However, I think it's a good idea to give
>> Ollie> users some idea what the option is good for.  Is it appropriate
>> Ollie> to mention these applications in the release notes?
>>
>> I think it makes sense, but I wonder what Mark's objection was.
> 
> Mark, would you like to comment?

I wouldn't characterize my objections as terribly strong.  It's
certainly nothing against distcc or ccache.  But, I think these kinds of
mentions are odd to put in our documentation.  The manual should say
what the options do.  Referencing specific tools, which may or may not
continue to exist, etc., seems odd to me.  The manual is a reference
text; this isn't reference information.

In a tutorial, or in release notes, I have no objection.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Does g++ have a intel/msdn __COUNTER__ macro equivalent??
  2007-09-13 22:33                 ` Mark Mitchell
@ 2007-09-13 22:56                   ` Ollie Wild
  0 siblings, 0 replies; 11+ messages in thread
From: Ollie Wild @ 2007-09-13 22:56 UTC (permalink / raw)
  To: Mark Mitchell, Gerald Pfeifer; +Cc: tromey, Dave Korn, mgbg25171, gcc

On 9/13/07, Mark Mitchell <mark@codesourcery.com> wrote:

> I wouldn't characterize my objections as terribly strong.  It's
> certainly nothing against distcc or ccache.  But, I think these kinds of
> mentions are odd to put in our documentation.  The manual should say
> what the options do.  Referencing specific tools, which may or may not
> continue to exist, etc., seems odd to me.  The manual is a reference
> text; this isn't reference information.
>
> In a tutorial, or in release notes, I have no objection.

Thanks, Mark.

Update sent to gcc-patches at
http://gcc.gnu.org/ml/gcc-patches/2007-09/msg01218.html.

Ollie

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-09-13 22:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-04 10:26 Does g++ have a intel/msdn __COUNTER__ macro equivalent?? me
2007-09-04 10:47 ` Dave Korn
2007-09-09 14:39   ` Gerald Pfeifer
2007-09-11 20:14     ` Ollie Wild
2007-09-11 20:58       ` Tom Tromey
2007-09-11 21:10         ` Gerald Pfeifer
2007-09-11 22:41           ` Ollie Wild
2007-09-13 16:00             ` Tom Tromey
2007-09-13 22:29               ` Ollie Wild
2007-09-13 22:33                 ` Mark Mitchell
2007-09-13 22:56                   ` Ollie Wild

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).