Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Why not exend character set in C++ code?

75 views
Skip to first unread message

asetof...@gmail.com

unread,
Oct 27, 2015, 4:01:23 PM10/27/15
to
ρι6
Why one can not define
in C++
a set
of operators as
int operatorρ(Matrix<T>& a)
?
Why not add 1/2 of new 16 bit
character
set as definable as operators
(points) and other 1/2 as
letter for names?

Wouter van Ooijen

unread,
Oct 27, 2015, 5:54:25 PM10/27/15
to
Op 27-Oct-15 om 9:00 PM schreef asetof...@gmail.com:
Which 'why' are you asking about?
- because the standard says that you can't
- because it is a bad idea to define new operators
- because Soustroup did not like it
- because that operator was not available in C
- because it would not merge well with the set of precedences
- because we generally prefer to use ASCII in modern programming langauges
- etc

Wouter

asetof...@gmail.com

unread,
Oct 28, 2015, 1:32:36 AM10/28/15
to
Only for that?
It is not only for the
character set
If I rethink the question
if one editor allow one
in the normal mathematical style
define operator as position too
b
a === pow(a, b)
Or index
A === a[j]
j

A. == A[1,2,3,4]
1,2,3,4

red floyd

unread,
Oct 28, 2015, 1:34:57 AM10/28/15
to
What part of "The Standard says you can not define new operators"
are you having trouble understanding?

Therefore, you can not have ===


asetof...@gmail.com

unread,
Oct 28, 2015, 3:28:11 AM10/28/15
to
You want to say is not possible
define operator as one of these
symbols?
♠ Ω ♤ ♣ ♧ ♥ ♡ ♦ ♢ ♔ ♕ ♚ ♛ ⚜ ★ ☆ ✮ ✯ ☄ ☾ ☽ ☼ ☀ ☁ ☂ ☃ ☻ ☺ ☹ ۞ ۩

εїз Ƹ̵̡Ӝ̵̨̄Ʒ ξЖЗ εжз ☎ ☏ ¢ ☚ ☛ ☜ ☝ ☞ ☟ ✍ ✌ ☢ ☣ ♨ ๑ ❀ ✿ ψ ♆ ☪ ☭ ♪ ♩ ♫ ♬ ✄ ✂ ✆ ✉ ✦ ✧

♱ ♰ ∞ ♂ ♀ ☿ ❤ ❥ ❦ ❧ ™ ® © ✖ ✗ ✘ ⊗ ♒

■ □ ▢ ▲ △ ▼ ▽ ◆ ◇ ○ ◎ ● ◯ Δ ◕ ◔

ʊ ϟ ღ ツ 回 ₪ 卐 ™ © ® ¿ ¡ ½ ⅓ ⅔ ¼ ¾ ⅛ ⅜ ⅝ ⅞ ℅ № ⇨ ❝ ❞ # & ℃

∃ ∧ ∠ ∨ ∩ ⊂ ⊃ ∪ ⊥ ∀ Ξ Γ ɐ ə ɘ ε β ɟ ɥ ɯ ɔ и ๏ ɹ ʁ я ʌ ʍ λ ч ∞ Σ Π

➀ ➁ ➂ ➃ ➄ ➅ ➆ ➇ ➈ ➉ ➊ ➋ ➌ ➍ ➎ ➏ ➐ ➑ ➒ ➓

Ⓐ Ⓑ Ⓒ Ⓓ Ⓔ Ⓕ Ⓖ Ⓗ Ⓘ Ⓙ Ⓚ Ⓛ Ⓜ Ⓝ Ⓞ Ⓟ Ⓠ Ⓡ Ⓢ Ⓣ Ⓤ Ⓥ Ⓦ Ⓧ Ⓨ Ⓩ

ⓐ ⓑ ⓒ ⓓ ⓔ ⓕ ⓖ ⓗ ⓘ ⓙ ⓚ ⓛ ⓜ ⓝ ⓞ ⓟ ⓠ ⓡ ⓢ ⓣ ⓤ ⓥ ⓦ ⓧ ⓨ ⓩ

℘ ℑ ℜ ℵ ♏ η α βεℓℓα

· ¨ … ¦ ┅ ┆ ┈ ┊ ╱ ╲ ╳ ¯ – —

≡ ჻ ░ ▒ ▓ ▤ ▥ ▦ ▧ ▨ ▩ █ ▌ ▐ ▀ ▄

◠ ◡ ╭ ╮ ╯ ╰

│ ┤ ╡ ╢ ╖ ╕ ╣ ║ ╝ ╜ ╛ ┐ └ ┴ ┬ ├ ─ ┼ ╞ ╟ ╚ ╔ ╩ ╦ ╠ ═ ╬ ╧ ╨ ╤ ╥ ╙ ╘ ╒ ╓ ╫ ╪ ┘ ┌

ツ ♋ 웃 유 Σ ⊗ ♒ ☠ ☮ ☯ ♠ Ω ♤ ♣ ♧ ♥ ♡ ♦♢♔ ♕ ♚ ♛ ★ ☆ ✮ ✯ ☄ ☾ ☽ ☼ ☀ ☁ ☂ ☃ ☻ ☺ ۞ ۩ ♬ ✄ ✂ ✆ ✉ ✦ ✧ ∞ ♂ ♀ ☿ ❤ ❥ ❦ ❧ ™ ® © ✗ ✘ ⊗ ♒ ▢ ▲ △ ▼ ▽ ◆ ◇ ○ ◎ ● ◯ Δ ◕ ◔ ʊ ϟ ღ 回 ₪ ✓ ✔ ✕ ✖ ☢ ☣ ☤ ☥ ☦ ☧ ☨ ☩ ☪ ☫ ☬ ☭ ☹ ☺ ☻ ت ヅ ツ ッ シ Ü ϡ ♋ ♂ ♀ ☿ ♥ ❤ ❥ 웃 유 ♡ ۵ ❣ ☼ ☀ ☁ ☂ ☃ ☄ ☾ ☽ ❄ ☇ ☈ ⊙ ☉ ℃ ℉ ° ♪ ♫ ♩ ♬ ♭ ♮ ♯ ° ø ✽ ✾ ✿ ❀ ❁ ❃ ♚ ♛ ♜ ♝ ♞ ♟  ♔ ♕ ♖ ♗ ♘ ♙ ✉ ✍ ✎ ✏ ✐✑✒ ⌨ ☑ ✓ ✔ ☒ ☓ ✕ ✖ ✗ ✘ ✦ ★ ☆ ✰ ✮ ✯ ❇ ❈ ❅ ❄ ❆ ╰☆╮ Æ æ ❖ ℘ℑℜℵ♏η αβεℓℓα· ¨…¦┅┆┈ ┊╱╲╳¯– —≡჻░▒▓ ▤▥▦▧▨▩█ ▌▐▀▄ ◠◡╭╮╯╰ │┤╡╢╖╕╣ ║╝╜╛ ┐ └┴┬├─┼ ╞╟╚╔╩╦ ╠═ ╬╧╨╤ ╥╙╘╒╓ ╫╪┘┌

{。^◕‿◕^。} (◕^^◕) ✖✗✘♒♬✄ ✂✆✉✦✧♱ ♰♂♀☿❤❥ ❦❧
™®©♡♦ ♢♔♕♚♛★ ☆✮ ✯☄☾☽ ☼☀☁☂☃☻ ☺☹ ☮۞۩ εїз☎☏¢ ☚☛☜☝☞☟✍ ✌☢☣☠☮☯ ♠♤♣♧♥ ♨๑❀✿ ψ☪☭♪ ♩♫℘ℑ ℜℵ♏ηα ʊϟღツ回 ₪™ ©®¿¡½⅓ ⅔¼¾⅛⅜⅝⅞℅
№⇨❝❞ ◠◡╭╮╯╰ ★☆⊙¤㊣ ★☆♀◆◇ ▆▇██■ ▓回□〓≡
╝╚╔╗╬ ═╓╩ ┠┨┯┷┏ ┓┗┛┳⊥ ﹃﹄┌ ┐└┘∟「 」↑↓→ ←↘↙♀ ♂┇┅﹉﹊ ﹍﹎╭╮╰╯ *^_^* ^*^ ^-^ ^_^ ^︵^∵∴‖ ︱︳︴﹏ ﹋﹌♂♀ ♥♡☜☞☎ ☏⊙◎☺☻ ►◄▧▨ ♨◐◑↔↕ ▪▫☼♦▀ ▄█▌▐ ░▒▬♦◊ ◦☼♠♣▣ ▤▥▦▩ ぃ◘◙◈♫ ♬♪♩♭♪ の☆→あ £❤。◕‿ ◕。✎✟ஐ ≈๑۩ ۩.. ..۩۩๑ ๑۩۞۩๑ ✲❈➹ ~.~◕ ‿-。☀☂☁ 【】┱┲❣ ✚✪✣ ✤✥ ✦❉ ❥❦❧❃ ❂❁❀✄☪ ☣☢☠☭♈ ✓✔✕ ✖㊚㊛ *.:。 ✿*゚‘゚・ ⊙¤㊣★☆
♀◆◇ ◣◢◥▲ ▼△▽⊿◤ ◥▆▇ ██■▓ 回□〓≡╝ ╚╔╗ ╬═╓╩ ┠┨┯┷┏ ┓┗┛ ┳⊥﹃﹄ ┌┐└┘∟ 「」↑↓ →←↘↙ ♀♂┇┅﹉ ﹊﹍﹎ ╭╮╰╯ *^_^* ^*^ ^-^ ^_^ ^︵^∵ ∴‖ ︱︳ ︴﹏﹋﹌ ♂♀♥♡☜ ☞☎☏⊙ ◎☺☻►◄ ▧▨♨◐◑ ↔↕ ▪▫ ☼♦▀▄█ ▌▐░▒▬ ♦◊◦☼ ♠♣▣▤▥ ▦▩ぃ◘◙ ◈♫♬♪ ♩♭♪の☆ →あ£❤。 ◕‿◕。 ✎✟ஐ≈ ๑۩۩.. ..۩ ۩๑๑۩۞ ۩
๑✲❈ ➹ ~.~◕‿-。 ☀☂☁【】 ┱┲❣✚ ✪✣✤✥ ✦❉❥❦ ❧❃❂❁❀ ✄☪☣☢☠ ☭♈ ✓ ✔✕✖㊚ ㊛ *.:。✿*゚ ‘゚・ ◊♥╠═╝▫■๑»«¶ஐ©† εïз♪ღ♣ ♠•± °•ิ.•ஐஇ *×○▫
♂•♀◊©¤ ▲↔™®☎ε їз♨ ☏☆★ ▽△▲ ∵∴∷ #♂♀♥♠♣
♧♤♧ ♡♬♪ ♭♫♪ﻬஐღ ↔↕↘••● ¤╬﹌▽☜♥☞ ♬✞♥♕☯☭☠☃ ─ ━ │ ┃ ┄ ┅ ┆ ┇ ┈ ┉ ┊ ┋ ╭ ╮ ╯ ╰ ╱ ╲ ╳ ╴ ╵ ╶ ╷ ╸ ╹ ╺ ╻ ╼ ╽ ╾ ╿ ▰ ▱ ◆ ◇ ◈ ◉ ◊ ○ ◌ ◍ ◎ ● ◐ ◑ ◒ ◓ ◔ ◕ ◖ ◗ ◘ ◙ ◚ ◛ ◜ ◝ ◞ ◟ ◠ ◡ ◢ ◣ ◤ ◥ ◦ ◧ ◨ ◩ ◪ ◫ ◬ ◭ ◮ ◯ ◰ ◱ ◲ ◳ ◴ ◵ ◶ ◷ ◸ ◹ ◺ ◻ ◼ ◽ ◾ ◿ ☀ ☁ ☂ ☃ ☄ ★ ☆ ☇ ☈ ☊ ☋ ☌ ☍ ☎ ☏ ☐ ☑ ☒ ☓ ☔ ☕ ☖ ☗ ☘ ☙ ☟ ☠ ☡ ☢ ☣ ☤ ☥ ☦ ☧ ☨ ☩ ☪ ☫ ☬ ☭ ☮ ☯ ☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷ ☸ ☹ ☺ ☻ ☼ ☽ ☾ ☿ ♀ ♁ ♂ ♃ ♄ ♅ ♇ ♔ ♕ ♖ ♗ ♘ ♙ ♚ ♛ ♜ ♝ ♞ ♟ ♠ ♡ ♢ ♣
♤ ♥ ♦ ♧ ♨ ♰ ♱ ´ ῾ ῿‏ ‐ ‑ ‒ – — ― ‖ ‗ ‘ ’ ‚ ‛ “ ” „ ‟ † ‡ • ‣
․ ‥ … ‧ 
 
   ‰ ‱ ′ ″ ‴ ‵ ‶ ‷ ‸ ‹ › ※ ‼ ‽ ‾ ‿ ⁀ ⁁ ⁂ ⁃ ⁄ ⁅ ⁆ ⁊ ⁋ ⁌ ⁍ ⁎ ⁏ ⁐ ⁑ ⁒ ⁓ ⁔ ⁕ ⁖ ⁗ ⁘ ⁙ ⁚ ⁛ ⁜ ⁝ ⁞   ⁠ ⁡ ⁢ ⁣ ⁤ ⁥ ⁦ ⁧ ⁨ ⁩       ₕ ₖ ₗ ₘ ₙ ₚ ₛ ₜ ₝ ₞ ₟ ₠ ₡ ₢ ₣ ₤ ₥ ₦ ₧ ₨ ₪ ₫ € ₭ ₮ ₯ ℀ ℁ ℂ ℄ ℅ ℆ ℇ ℈ ℉ ℊ ℋ ℌ ℍ ℎ ℏ ℐ ℑ ℒ ℓ ℔ ℕ
№ ℗ ℘ ℙ ℚ ℛ ℜ ℝ ℞ ℟ ℡ ™ ℣ ℤ ℥ Ω ℧ ℨ ℩ K Å ℬ ℭ ℮ ℯ ℰ ℱ Ⅎ ℳ ℴ ℵ ℶ ℷ ℸ ℹ ℺ ℻ ℼ ℽ ℾ ℿ ⅀ ⅁ ⅂ ⅃ ⅄ ⅅ ⅆ ⅇ ⅈ ⅉ ⅊ ⅋ ⅌ ⅍ ⅎ ⅏ ⅐ ⅑ ⅒ ⇫ ⇬ ⇭ ⇮ ⇯ ⇰ ⇱ ⇲ ⇳ ⇴ ⇵ ⇶ ⇷ ⇸ ⇹ ⇺ ⇻ ⇼ ⇽ ⇾ ⇿ ∀ ∁ ∂ ∃ ∄ ∅ ∆ ∇ ∈ ∉ ∊ ∋ ∌ ∍ ∎ ∏ ∐ ∑ − ∓ ∔
∕ ∖ ∗ ∘ ∙ √ ∛ ∜ ∝ ∞ ∟ ∠ ∡ ∢ ∣ ∤ ∥ ∦ ∧ ∨ ∩ ∪ ∴ ∵ ∶ ∷ ∸ ∹ ∺ ∻ ∼ ∽ ∾ ∿ ≀ ≁ ≪ ≫ ≬ ≭ ≮ ≯ ≰ ≱ ≲ ≳ ≴ ≵ ≶ ≷ ≸ ≹ ≺ ≻ ≼ ≽ ≾ ≿ ⊀ ⊁ ⊂ ⊃ ⊄ ⊅ ⊆ ⊇ ⊈ ⊉ ⊊ ⊋ ⊌ ⊍ ⊎ ⊏ ⊐ ⊑ ⊒ ⊓ ⊔ ⊕ ⊖ ⊗ ⊘ ⊙ ⊚ ⊛ ⊜ ⊝ ⊞ ⊟ ⊠ ⊡ ⊢ ⊣ ⊤ ⊥ ⊦ ⊧ ⊨ ⊩ ⊪ ⊫ ⊬ ⊭ ⊮ ⊯ ⊰ ⊱ ⊲ ⊳ ⊴ ⊵ ⊶ ⊷ ⊸ ⊹ ⊺ ⊻ ⊼ ⊽ ⊾ ⊿ ⋀ ⋁ ⋂ ⋃ ⋄ ⋅ ⋆ ⋇ ⋈ ⋉ ⋊ ⋋ ⋌ ⋍ ⋎ ⋏ ⋐ ⋑ ⋒ ⋓ ⋔ ⋕ ⋖ ⋗ ⋘ ⋙ ⋚ ⋛ ⋜ ⋝ ⋞ ⋟ ⋠ ⋡ ⋢ ⋣ ⋤ ⋥ ⋦ ⋧ ⋨ ⋩ ⋪ ⋫ ⋬ ⋭ ⋮ ⋯ ⋰ ⋱ ⋲ ⋳ ⋴ ⋵ ⋶ ⋷ ⋸ ⋹ ⋺ ⋻ ⋼ ⋽ ⋾ ⋿ ⌀ ⌁ ⌂ ⌃ ⌄ ⌅ ⌆ ⌇ ⌈ ⌉ ⌊ ⌋ ⌌ ⌍ ⌎ ⌏ ⌐ ⌑ ⌒ ⌓ ⌔ ⌕ ⌖ ⌗ ⌘ ⌙ ⌚ ⌛ ⌜ ⌝ ⌞ ⌟ ⌠ ⌡ ⌢ ⌣ ⌤ ⌥ ⌦ ⌧ ⌨ ⟨ ⟩ ⌫ ⌬ ⌭ ⌮ ⌯ ⌰ ⌱ ⌲ ⌳ ⌴ ⌵ ⌶ ⌷ ⌸ ⌹ ⌺ ⌻ ⌼ ⌽ ⌾ ⌿ ⍀ ⍁ ⍂ ⍃ ⍄ ⍅ ⍆ ⍇ ⍈ ⍉ ⍊ ⍋ ⍌ ⍍ ⍎ ⍏ ⍐ ⍑ ⍒ ⍓ ⍔ ⍕ ⍖ ⍗
⍘ ⍙ ⍚ ␋ ␢ ␣ ─ ━ │ ┃ ┄ ┅ ┆ ┇ ┈ ┉ ┊ ┋ ┌ ┍ ┎ ┏ ┐ ┑ ┒ ┓ └ ┕ ┖ ┗ ┘ ┙ ┚ ┛ ├ ┝ ┞ ┟ ┠ ┡ ┢ ┣ ┤ ┥ ┦ ┧ ┨ ┩ ┪ ┫ ┬ ┭ ┮ ┯ ┰ ┱ ┲ ┳ ┴ ┵ ┶ ┷ ┸ ┹ ┺ ┻ ┼ ┽ ┾ ┿ ╀ ╁ ╂ ╃ ╄
╅ ╆ ╇ ╈ ╉ ╊ ╋ ╌ ╍ ╎ ╏ ═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟ ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫
╬ ╭ ╮ ╯ ╰ ╱ ╲ ╳ ╴ ╵ ╶ ╷ ╸ ╹ ╺ ╻ ╼ ╽ ╾ ╿ ▀ ▁ ▂ ▃ ▄ ▅ ▆ ▇ █ ▉ ▊ ▋ ▌ ▍ ▎ ▏ ▐ ░ ▒ ▓ ▔ ▕ ▖ ▗ ▘ ▙ ▚ ▛ ▜ ▝ ▞ ▟ ■ □ ▢ ▣ ▤ ▥ ▦ ▧ ▨ ▩ ▪ ▫ ▬ ▭ ▮ ▯ ▰ ▱ ◆ ◇ ◈ ◉ ◊ ○ ◌ ◍ ◎ ● ◐ ◑ ◒ ◓ ◔ ◕ ◖ ◗ ◘ ◙ ◚ ◛ ◜ ◝ ◞ ◟ ◠ ◡ ◢ ◣ ◤ ◥ ◦ ◧ ◨ ◩ ◪ ◫ ◬ ◭ ◮ ◯ ◰ ◱ ◲ ◳ ◴ ◵ ◶ ◷ ◸ ◹ ◺ ◻ ◼ ◽ ◾ ◿ ☀ ☁ ☂ ☃ ☄ ★ ☆ ☇ ☈ ☊ ☋ ☌ ☍ ☎ ☏ ☐ ☑ ☒ ☓ ☔ ☕ ☖ ☗ ☘ ☙ ☟ ☠ ☡ ☢ ☣ ☤ ☥ ☦ ☧ ☨ ☩ ☪ ☫ ☬ ☭ ☮ ☯ ☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷ ☸ ☹ ☺ ☻ ☼ ☽ ☾ ☿ ♀ ♁ ♂ ♃ ♄ ♅ ♇ ♎ ♏ ♐ ♑ ♒ ♓ ♔ ♕ ♖ ♗ ♘ ♙ ♚ ♛ ♜ ♝ ♞ ♟ ♠ ♡ ♢ ♣ ♤ ♥ ♦ ♧ ♨ ♰ ♱ ☫ ª ↀ ↁ ↂ Ↄ ➟ ➡ ➢ ➣ ➤ ➥ ➦ ➧ ➨ ➚ ➘ ➙ ➛ ➜ ➝ ➞ ➸ ♐ ➲ ➳ ➳ ➴ ➵ ➶ ➷ ➸ ➹ ➺ ➻ ➼ ➽ ← ↑ → ↓ ↔ ↕ ↖ ↗ ↘ ↙ ↚ ↛ ↜ ↝ ↞ ↟ ↠ ↡ ↢ ↣ ↤ ↥ ↦ ↧ ↨ ➫ ➬ ➩ ➪ ➭ ➮ ➯ ➱ ↩ ↪ ↫ ↬ ↭ ↮ ↯ ↰ ↱ ↲ ↳ ↴ ↵ ↶ ↷ ↸ ↹ ↺ ↻ ↼ ↽ ↾ ↿ ⇀ ⇁ ⇂ ⇃ ⇄ ⇅ ⇆ ⇇ ⇈ ⇉ ⇊ ⇋ ⇌ ⇍ ⇎ ⇏ ⇐ ⇑ ⇒ ⇓ ⇔ ⇕ ⇖ ⇗ ⇘ ⇙ ⇚ ⇛ ⇜ ⇝ ⇞ ⇟ ⇠ ⇡ ⇢ ⇣ ❂ ⋆ ✢ ✣ ✤ ✥ ✦ ✧ ✩ ✪ ✫ ✬ ✭ ✮ ✯ ✰ ★ ✱ ✲ ✳ ✴ ✵ ✶ ✷ ✸ ✹ ✺ ✻ ✼ ❄ ❅ ❆ ❇ ❈ ❉ ❊ ❋ ╰☆╮ ✡ ❂ -‘๑’- ⎈

guinne...@gmail.com

unread,
Oct 28, 2015, 7:06:57 AM10/28/15
to
On Wednesday, 28 October 2015 07:28:11 UTC, asetof...@gmail.com wrote:
> You want to say is not possible
> define operator as one of these
> symbols?

<snip font dump>

Yes.

If you have a copy of the standard, read the [over.oper] chapter.

If you don't, read the final draft (N3797, which can be found at
http://open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3797.pdf) section 13.5,
which lists exactly which operators can be overloaded and which can not.

New operator names cannot be created. You can only overload existing-named
operators (except for a few for which this is not permitted, either).

Alf P. Steinbach

unread,
Oct 28, 2015, 6:06:19 PM10/28/15
to
On 10/27/2015 9:00 PM, asetof...@gmail.com wrote:
> ρι6

What?


> Why one can not define in C++ a set of operators as
> int operatorρ(Matrix<T>& a)
> ?

As I recall Prolog supports definining new operators, but C++ doesn't.
The C++ syntax is just too complex already.

You can however redefine the meaning of most existing operators, for
class and enumeration type arguments.


> Why not add 1/2 of new 16 bit character set

"new 16-bit character set"? I think you must be referring to 16-bit
Unicode. That's 1991, 24 years ago. Since then, I think it was in 1996,
Unicode has been extended to effectively 21 bits.

Still, Windows console windows are effectively constrained to the 16 bit
subset of Unicode corresponding to original Unicode.

That subset is called the "BMP", the Basic Multilingual Plane of
Unicode, and using it for encoding of characters is called UCS2, which
effectively is a subset of UTF-16 (i.e., can be interpreted as UTF-16).


> as definable as operators (points) and other 1/2 as letter for names?

Regarding names, formally C++ supports using general Unicode letters in
identifiers, from a specific subset of Unicode that some standard
designates as suitable for identifiers across programming languages.

Unfortunately compilers such as GNU g++ generally refuse anything but
the English alphabet present in ASCII. This means that code that uses
national characters in names, e.g. "antall_blåbærsyltetøyglass", may
compile with e.g. Visual C++ and fail to compile with g++.

Disclaimer: I haven't tested this with g++ the last couple of years. I
guess the time is ripe to test again. ;-)


Cheers & hth.,

- Alf

Anand Hariharan

unread,
Oct 28, 2015, 6:44:15 PM10/28/15
to
Guess what? Bjarne Stroustrup 'agrees' with you:

http://www.stroustrup.com/whitespace98.pdf

(Make sure you read the paper in *entirety*)

- Anand

Öö Tiib

unread,
Oct 29, 2015, 5:14:10 AM10/29/15
to
On Wednesday, 28 October 2015 09:28:11 UTC+2, asetof...@gmail.com wrote:
> You want to say is not possible
> define operator as one of these
> symbols?

It is simple. If you are programmer then anything is possible to do.
It does not matter what others want or don't want to say.

C++ standard defines only usage of most of the ASCII characters
but that does not matter for programmer. Lets say you have code:

auto a = white_chess_rook( x, y );

With some operator overloading tricks you can turn it into:

auto a = x *white_chess_rook* y;

Then you can change the text editor to automatically show/use '♖'
instead of '*white_chess_rook*' like that:

auto a = x ♖ y;

As result compiler still gets what is required by standard and you get
to see and to use your odd characters that you want and we do not
need to modify the programming language.

From my keyboard it is not too convenient to type characters like
that white chess rook character and the whole eye-candy leaves me
indifferent so I do not want your editor.

asetof...@gmail.com

unread,
Oct 29, 2015, 5:24:32 AM10/29/15
to
You not think enough...

asetof...@gmail.com

unread,
Oct 29, 2015, 5:27:21 AM10/29/15
to
Yes I not think enough too

asetof...@gmail.com

unread,
Oct 29, 2015, 6:54:56 AM10/29/15
to
_________
Excuse me you are right
I think is possible modify
the macro sys to handle
a=x♖y;
case

asetof...@gmail.com

unread,
Oct 29, 2015, 7:11:47 AM10/29/15
to
%operatorDefine ♖ f
Possibly a=x♖(z♖z); case too in

a=f(x, (f(z,z)))
too


David Brown

unread,
Oct 29, 2015, 8:33:26 AM10/29/15
to
On 29/10/15 10:13, Öö Tiib wrote:
> On Wednesday, 28 October 2015 09:28:11 UTC+2, asetof...@gmail.com wrote:
>> You want to say is not possible
>> define operator as one of these
>> symbols?
>
> It is simple. If you are programmer then anything is possible to do.
> It does not matter what others want or don't want to say.
>
> C++ standard defines only usage of most of the ASCII characters
> but that does not matter for programmer. Lets say you have code:
>
> auto a = white_chess_rook( x, y );
>
> With some operator overloading tricks you can turn it into:
>
> auto a = x *white_chess_rook* y;

One can do even better than that. Make the operator overloading tricks
so that you are using "* do_white_chess_rook *", and then have:

#define white_chess_rook * do_white_chess_rook *

Then you can write:

auto a = x white_chess_rook y;

>
> Then you can change the text editor to automatically show/use '♖'
> instead of '*white_chess_rook*' like that:
>
> auto a = x ♖ y;
>
> As result compiler still gets what is required by standard and you get
> to see and to use your odd characters that you want and we do not
> need to modify the programming language.
>
> From my keyboard it is not too convenient to type characters like
> that white chess rook character and the whole eye-candy leaves me
> indifferent so I do not want your editor.
>

#include <cmath>
#include <iostream>

template<class T>
class DoPowerer {
T x_;
public :
constexpr DoPowerer(T x) : x_(x) {};
template<class U>
friend constexpr U operator*(const DoPowerer<U> dp, const U y);
};

class Powerer {
template<class T>
friend constexpr DoPowerer<T> operator*(const T x, const Powerer p);
};

template<class T>
constexpr DoPowerer<T> operator*(const T x, const Powerer p
__attribute__((unused)) {
return DoPowerer<T>(x);
}

template<class T>
constexpr T operator*(const DoPowerer<T> dp, const T y) {
return std::pow(dp.x_, y);
}

static constexpr const Powerer powerer;
#define power *powerer*

int main() {
std::cout << "6 power 3 = " << (6 power 3) << std::endl;
std::cout << "2.0 power 0.5 = " << (2.0 power 0.5) << std::endl;
}

So now "power" is somewhat like a new operator. And once gcc gets
extended identifiers (clang has them from 3.3 onwards), you can write:

#define ↑ *powerer*

and then you get to write 2 ↑ 10 instead of std::pow(2, 10).


Whether or not you think this is a good thing, is a different matter.

0 new messages