Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
May 25, 2011 Any example of using these Special Tokens? | ||||
---|---|---|---|---|
| ||||
Hi, I am not able make use of these 3 special tokens to print something. writefln("gshared: %s",__gshared); writefln("thread: %s",__thread); writefln("traits: %s",__traits); ------------------------------------------------------------ rc\Sample.d(128): expression expected, not '__gshared' src\Sample.d(129): expression expected, not '__thread' src\Sample.d(130): found ')' when expecting '(' src\Sample.d(130): __traits(identifier, args...) expected src\Sample.d(132): found '}' when expecting ',' src\Sample.d(146): expression expected, not 'EOF' src\Sample.d(146): found 'EOF' when expecting ',' src\Sample.d(146): expression expected, not 'EOF' src\Sample.d(146): found 'EOF' when expecting ',' src\Sample.d(146): expression expected, not 'EOF' ------------------------------------------------------------ Would some like to show me how this is done?? -- Matthew Ong email: ongbp@yahoo.com |
May 25, 2011 Re: Any example of using these Special Tokens? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Ong | Matthew Ong: > I am not able make use of these 3 special tokens to print something. > > writefln("gshared: %s",__gshared); > writefln("thread: %s",__thread); > writefln("traits: %s",__traits); They are keywords, so it's like writing: writefln("traits: %s", for); > Would some like to show me how this is done?? What do you want to do? Bye, bearophile |
May 25, 2011 Re: Any example of using these Special Tokens? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On 5/25/2011 5:45 PM, bearophile wrote: > Matthew Ong: > >> I am not able make use of these 3 special tokens to print something. >> >> writefln("gshared: %s",__gshared); >> writefln("thread: %s",__thread); >> writefln("traits: %s",__traits); > > They are keywords, so it's like writing: > writefln("traits: %s", for); > > >> Would some like to show me how this is done?? > > What do you want to do? > > Bye, > bearophile Looking at if they are run time related debug variables, perhaps consider using them within a logging api. -- Matthew Ong email: ongbp@yahoo.com |
May 25, 2011 Re: Any example of using these Special Tokens? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Ong | Am 25.05.2011 12:42, schrieb Matthew Ong:
> On 5/25/2011 5:45 PM, bearophile wrote:
>> Matthew Ong:
>>
>>> I am not able make use of these 3 special tokens to print something.
>>>
>>> writefln("gshared: %s",__gshared);
>>> writefln("thread: %s",__thread);
>>> writefln("traits: %s",__traits);
>>
>> They are keywords, so it's like writing:
>> writefln("traits: %s", for);
>>
>>
>>> Would some like to show me how this is done??
>>
>> What do you want to do?
>>
>> Bye,
>> bearophile
>
> Looking at if they are run time related debug variables, perhaps
> consider using them within a logging api.
and what is the benefit over using libary functions?
how many of this special vars will come (and pollute the global namespace...)
|
May 25, 2011 Re: Any example of using these Special Tokens? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Ong | Am 25.05.2011 10:29, schrieb Matthew Ong: > Hi, > > I am not able make use of these 3 special tokens to print something. > > writefln("gshared: %s",__gshared); > writefln("thread: %s",__thread); > writefln("traits: %s",__traits); > > ------------------------------------------------------------ > rc\Sample.d(128): expression expected, not '__gshared' > src\Sample.d(129): expression expected, not '__thread' > src\Sample.d(130): found ')' when expecting '(' > src\Sample.d(130): __traits(identifier, args...) expected > src\Sample.d(132): found '}' when expecting ',' > src\Sample.d(146): expression expected, not 'EOF' > src\Sample.d(146): found 'EOF' when expecting ',' > src\Sample.d(146): expression expected, not 'EOF' > src\Sample.d(146): found 'EOF' when expecting ',' > src\Sample.d(146): expression expected, not 'EOF' > ------------------------------------------------------------ > > Would some like to show me how this is done?? google is your friend, search for "__traits d" http://www.digitalmars.com/d/2.0/traits.html |
May 25, 2011 Re: Any example of using these Special Tokens? | ||||
---|---|---|---|---|
| ||||
Posted in reply to dennis luehring | I think __thread might be an alias for thread local. Maybe it was used explicitly in D1 since D1 didn't have TLS by default? |
Copyright © 1999-2021 by the D Language Foundation