string escape in wdk

hi guys,

I found that string “??)” is converted to “]” automatically when i compilie with wdk.
Is there any document describing this?

Regards
Herb

Is it a trigraph?

mm
On Mar 3, 2015 12:48 AM, wrote:

> hi guys,
>
> I found that string “??)” is converted to “]” automatically when i
> compilie with wdk.
> Is there any document describing this?
>
> Regards
> Herb
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

On 03-Mar-2015 10:47, xxxxx@hotmail.com wrote:

hi guys,

I found that string “??)” is converted to “]” automatically when i compilie with wdk.
Is there any document describing this?

Regards
Herb

Try to compile with /Zc:trigraphs-

–pa

xxxxx@hotmail.com wrote:

I found that string “??)” is converted to “]” automatically when i compilie with wdk.
Is there any document describing this?

This is not a WDK thing. This is little-known feature of ANSI Standard
C – trigraphs. It was introduced in part because some of the
characters used in C were not commonly found on keypunches.

https://msdn.microsoft.com/en-us/library/bt0y4awe.aspx

You can turn this off, as Pavel pointed out.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Got it, thank you mates.

Hereb

In all my years programming in C, this thread is the first time I heard of trigraphs.

You learn something every day,

Peter
OSR
@OSRDrivers

> In all my years programming in C, this thread is the first time I heard of trigraphs.

I can nearly second this, since I’ve only read about them in C++ book by Stroustrup/Ellis dated circa 1990.

Never met them in practice, and never thought they can appear in string literals.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

(I realize this is far off topic, but I beg forbearance)

So, Google is my friend.

You can apparently use these trigraphs ANYWHERE in your code in place of the specific character… not just in quotes.

So you can write:

??=if DBG
…code here…
??=endif

or… worse… (from a document written during the C++ standard committee’s debate about removing trigraphs from the latest version of C++):

int main ()
??<
int a = ??/
3;
return a;
??>

One of the major use-cases for this is apparently to allow you to code C/C++ in EBCDIC. And for some non-US keyboards that have national letters and symbols where things like [ might otherwise appear?

I never even imagined this. Strange to find something like this out after all these years…

Peter
OSR
@OSRDrivers

> You can apparently use these trigraphs ANYWHERE in your code in place of the specific

character… not just in quotes.

Yes, they are parsed before # in preprocessor definitions (Stroustrup/Ellis had a sample) and before escapes in string literals, so you can use them to escape \n.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

That’s C language equivalent of “Strangest laws that exist in the world and US”

It is actually an interesting topic !

For record, I never saw this. But way back when there were few other
languages fighting to get the main stage, I know there were languages
that does not want to have any notion of scope based on { } or ( ) or
or some such, I guess ADA or some language wanted just tab ( \t)
or something. Did not delve into the reason(s), but there was sincere
( or not ) thoughts about those special char being not necessary !

But EBCDIC ? I thought that was just IBM thing. Does it cover the
UNICODE or multi-language coding space ? Perhaps it does.

-Pro

On Wed, Mar 4, 2015 at 8:15 AM, wrote:
> (I realize this is far off topic, but I beg forbearance)
>
> So, Google is my friend.
>
> You can apparently use these trigraphs ANYWHERE in your code in place of the specific character… not just in quotes.
>
> So you can write:
>
> ??=if DBG
> …code here…
> ??=endif
>
> or… worse… (from a document written during the C++ standard committee’s debate about removing trigraphs from the latest version of C++):
>
> int main ()
> ??<
> int a = ??/
> 3;
> return a;
> ??>
>
> One of the major use-cases for this is apparently to allow you to code C/C++ in EBCDIC. And for some non-US keyboards that have national letters and symbols where things like [ might otherwise appear?
>
> I never even imagined this. Strange to find something like this out after all these years…
>
> Peter
> OSR
> @OSRDrivers
>
>
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

> or some such, I guess ADA or some language wanted just tab ( \t)

ADA is Algol/Pascal/PL style with “begin” and “end”.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

Prokash Sinha wrote:

For record, I never saw this. But way back when there were few other
languages fighting to get the main stage, I know there were languages
that does not want to have any notion of scope based on { } or ( ) or
or some such, I guess ADA or some language wanted just tab ( \t)
or something. Did not delve into the reason(s), but there was sincere
( or not ) thoughts about those special char being not necessary !

Many bizarre choices have been made over the years. When Control Data
implemented Algol 60, for inexplicable reasons, they decided all of the
keywords had to be surrounded with single quotes:
‘FOR’ P := 1 ‘STEP’ 1 ‘UNTIL’ 10 ‘DO’
‘BEGIN’
‘PRINT’ I
‘END’

However, in the limited space available in the CDC’s 6-bit characters,
single quote was not a default choice. Their scientific focus meant
that most printers shipped with the not equal sign in that slot, making
the code practically unreadable:

≠FOR≠ P := 1 ≠STEP≠ 1 ≠UNTIL≠ 10 ≠DO≠
≠BEGIN≠
≠PRINT≠ I
≠END≠

But EBCDIC ? I thought that was just IBM thing. Does it cover the
UNICODE or multi-language coding space ? Perhaps it does.

It IS just an IBM thing. It evolved from keypunch punch codes. That’s
why, for example, the alphabetical characters are not contiguous. In
keypunch land, A-I use a different coding in the 12/11 rows than J-R,
and because of that in EBCDIC J is not equal to I+1, and S is not equal
to R+1. Also, the lower case letters were less than the upper case
letters. That made collating a rather tricky problem, and is one reason
why EBCDIC died out.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

That’s interesting.

Thanks for the history there, Tim.

mm

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Thursday, March 05, 2015 10:04 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] string escape in wdk

Prokash Sinha wrote:

For record, I never saw this. But way back when there were few other
languages fighting to get the main stage, I know there were languages
that does not want to have any notion of scope based on { } or ( ) or
or some such, I guess ADA or some language wanted just tab ( \t)
or something. Did not delve into the reason(s), but there was sincere
( or not ) thoughts about those special char being not necessary !

Many bizarre choices have been made over the years. When Control Data implemented Algol 60, for inexplicable reasons, they decided all of the keywords had to be surrounded with single quotes:
‘FOR’ P := 1 ‘STEP’ 1 ‘UNTIL’ 10 ‘DO’
‘BEGIN’
‘PRINT’ I
‘END’

However, in the limited space available in the CDC’s 6-bit characters, single quote was not a default choice. Their scientific focus meant that most printers shipped with the not equal sign in that slot, making the code practically unreadable:

≠FOR≠ P := 1 ≠STEP≠ 1 ≠UNTIL≠ 10 ≠DO≠
≠BEGIN≠
≠PRINT≠ I
≠END≠

But EBCDIC ? I thought that was just IBM thing. Does it cover the
UNICODE or multi-language coding space ? Perhaps it does.

It IS just an IBM thing. It evolved from keypunch punch codes. That’s why, for example, the alphabetical characters are not contiguous. In keypunch land, A-I use a different coding in the 12/11 rows than J-R, and because of that in EBCDIC J is not equal to I+1, and S is not equal to R+1. Also, the lower case letters were less than the upper case letters. That made collating a rather tricky problem, and is one reason why EBCDIC died out.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Yeah, All these were explained by Fred Brooks while we were at it, learning the architecture evolution. Decimal computer to Binary computer. Punch card and paper tape machines dictated coding techniques etc …
IIRC, the main take away from that was space that would take for binaries, and the underlying market language(s). Memory was at a premium.
I’m not a language expert, Peter might be the right person. But I guess some Chinese language has the largest alphabet. And not sure if UNICODE is the right design either, sorry for being ignorant here :). I would not be surprised if something again come to play a major role in settling for yet another coding system.
Of hand, I don’t remember the language ( actually a powerful one), that solely relied on tabs/spaces to define scope.
That is why it is interesting topic !
Pro

From: xxxxx@gmail.com
To: xxxxx@lists.osr.com
Subject: RE: [ntdev] string escape in wdk
Date: Thu, 5 Mar 2015 10:09:01 -0800

That’s interesting.

Thanks for the history there, Tim.

mm

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Thursday, March 05, 2015 10:04 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] string escape in wdk

Prokash Sinha wrote:
> For record, I never saw this. But way back when there were few other
> languages fighting to get the main stage, I know there were languages
> that does not want to have any notion of scope based on { } or ( ) or
> or some such, I guess ADA or some language wanted just tab ( \t)
> or something. Did not delve into the reason(s), but there was sincere
> ( or not ) thoughts about those special char being not necessary !

Many bizarre choices have been made over the years. When Control Data implemented Algol 60, for inexplicable reasons, they decided all of the keywords had to be surrounded with single quotes:
‘FOR’ P := 1 ‘STEP’ 1 ‘UNTIL’ 10 ‘DO’
‘BEGIN’
‘PRINT’ I
‘END’

However, in the limited space available in the CDC’s 6-bit characters, single quote was not a default choice. Their scientific focus meant that most printers shipped with the not equal sign in that slot, making the code practically unreadable:

$B!b(BFOR$B!b(B P := 1 $B!b(BSTEP$B!b(B 1 $B!b(BUNTIL$B!b(B 10 $B!b(BDO$B!b(B
$B!b(BBEGIN$B!b(B
$B!b(BPRINT$B!b(B I
$B!b(BEND$B!b(B

> But EBCDIC ? I thought that was just IBM thing. Does it cover the
> UNICODE or multi-language coding space ? Perhaps it does.

It IS just an IBM thing. It evolved from keypunch punch codes. That’s why, for example, the alphabetical characters are not contiguous. In keypunch land, A-I use a different coding in the 12/11 rows than J-R, and because of that in EBCDIC J is not equal to I+1, and S is not equal to R+1. Also, the lower case letters were less than the upper case letters. That made collating a rather tricky problem, and is one reason why EBCDIC died out.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

>Of hand, I don’t remember the language ( actually a powerful one), that solely relied on tabs/spaces to

define scope.

Python?


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

Python is surely one, and may be it was what mentioned in an article !
Pro

On Tue, Mar 10, 2015 at 2:46 AM, Maxim S. Shatskih
wrote:
>>Of hand, I don’t remember the language ( actually a powerful one), that solely relied on tabs/spaces to
>>define scope.
>
> Python?
>
> –
> Maxim S. Shatskih
> Microsoft MVP on File System And Storage
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer