Jump to content
Nytro

C++ :)

Recommended Posts

Ma uitam astazi peste standardul C++:

http://www-d0.fnal.gov/~dladams/cxx_standard.pdf

Si am gasit niste lucruri interesante.

A scris codul urmator:


%:include<stdio.h>

int main()
<%
int x = (compl 1 bitor 2) bitand 1;
short y[2];
y<:0:> = 2;
printf("%d", y[0]);
return x xor_eq 0;
%>

Desi pare ciudat, este valid. Standardul C++ propune niste alternative:

Astfel, se pot folosi alternative la: "#", "{", "}", "[", "]" si operatorii logici si cei logici la nivel de bit. De exemplu:

- { se poate inlocui cu <%

- } se poate inlocui cu %>

- [x] cu <:X:>

- # cu %:

- | si & cu bitor su bitand

Si asa mai departe. Verificati pagina 38 a documentului de mai sus.

Insa nu stiu cate compilatoare accepta aceste alternative. Eu am testat pe GNU C++ pe Linux si nu am avut probleme. Astept niste teste din partea voastra.

Nu e prea util, dar e interesant si bine de stiut :)

Edit: Testat si pe MinGW pe Windows, nici o problema :)

Edited by Nytro
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...