Odd Looking declarations: char a??(3??)

Any idea what this syntax is?

Porting some CPP code from VS2005 - will not compile in VS2010

Thought at first it was corrupted files - but files appear to be ok.

Syntax appears a lot in function variable declaration as well as within structs.

Seems be be an array - but would there be any reason the previous programmer would have used this "name??(n??)" syntax over just "name[n]" (that also appears in the code)?

Sample code below.

Thanks very much.



1
2
3
4
	char		szlast[2] = {0};
	char		previous_forward??(27??) = {0};
	char		previous_nm??(13??) = {0};	
	char		temp_pnt_str[21] = {0};


Last edited on
They are called trigraphs.
http://en.cppreference.com/w/cpp/language/operator_alternative#Digraphs_and_trigraphs

I don't why they were used. Maybe the programmer who wrote the code found it difficult to type [ and ] on his keyboard.
https://en.wikipedia.org/wiki/Digraphs_and_trigraphs#C


As for reason, obfuscation I suppose.
Thats great thanks:) - was going to just replace with [] but worried I was missing a trick somewhere. Thanks for the links.

Hard to find syntax stuff like this (question marks, and other symbols) on google.

Last edited on
Digraphs and trigraphs are planned to be removed (or disabled by default) in C++1z

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3981.html
Last edited on
Topic archived. No new replies allowed.