# Cppfront - C++와 호환되는 실험적 컴파일러

> Clean Markdown view of GeekNews topic #8616. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=8616](https://news.hada.io/topic?id=8616)
- GeekNews Markdown: [https://news.hada.io/topic/8616.md](https://news.hada.io/topic/8616.md)
- Type: news
- Author: [opal58](https://news.hada.io/@opal58)
- Published: 2023-03-05T23:53:10+09:00
- Updated: 2023-03-05T23:53:10+09:00
- Original source: [github.com/hsutter](https://github.com/hsutter/cppfront)
- Points: 7
- Comments: 0

## Topic Body

ISO C++ 위원회 의장인 Herb Sutter가 제안  
> I want to keep writing code in C++... just "nicer"  
  
기존 C++와 완전히 호환되는 새로운 구문(syntax)으로 간결하고 안전하게 도구화할 수 있는지 탐구하는 프로젝트  
  
메이저 컴파일러(MSVC, GCC, Clang) C++20 이상에서 동작  
  
```cpp  
// Cppfront  
main: () -> int = {  
    vec: std::vector&lt;std::string&gt; = ("hello", "2022");  
    view: std::span = vec;  
  
    for view do :(inout str: _) = {  
        len := decorate(str);  
        println(str, len);  
    }  
}  
  
decorate: (inout thing: _) -> int = { /*...*/ }  
println: (x: _, len: _) = { /*...*/ }  
  
// Cpp  
[[nodiscard]] auto main() -> int{  
    std::vector&lt;std::string&gt; vec {"hello", "2022"};   
    std::span view {vec};   
  
    for ( auto&& cpp2_range = view;  auto& str : cpp2_range ) {  
        auto len {decorate(str)};   
        println(str, len);  
    }  
}  
  
[[nodiscard]] auto decorate(auto& thing) -> int { /*...*/ }  
auto println(auto const& x, auto const& len) -> void { /*...*/ }  
```

## Comments



_No public comments on this page._
