DelphiFeeds.com

  • Dashboard
  • Popular Stories
  • Trending Stories
  • Feeds
  • Login
Trending now

HeidiSQL Is A Lightweight Open Source Database Management Tool Built In Delphi

Get These Visually Stunning FireMonkey Styles Free To Enhance User Experience In Your Delphi Apps

VCL Styles: Master The Secrets Of Beautiful Modern Apps In Windows 10

grep for Delphi .dproj file containing copy commands for certain DLLs

Powerful Cross Platform Multitrack Music Recording Software Built In Delphi FireMonkey

Ultra-Fast Enterprise-Grade List And Label Reporting Tool For Delphi

Learn An Efficient Way to Use C++ Extern Templates For Robust Windows Development

Learn How To Work With Powerful In Memory DataSets Using Local SQL In Delphi

Easily Control Android App Permissions In Delphi With Mobile Permissions Component

Webinar: Develop Web Clients from the Delphi IDE

The Indy unit `IdObjs` got removed after Delphi 2007

Powerful Shipping Container Cargo Optimizer Built In Delphi FireMonkey

Modernizing Your Legacy Delphi Projects

Learn How to Use C++ Bidirectional Fences For Windows Development With C++Builder

Quickly Set Up Flexible Master-Detail Relationships Between Datasets In Delphi Apps

Learn How To Use Auto-Typed Variables In C++ For Windows Development

1
Pabitra Dash Pabitra Dash 2 months ago in auto-type, C++, c++11, cbuilder, Clang, Code, IDE, learn c++, programming, RAD Studio, variable 0

auto-typed variables is a C++11 feature that allows the programmer to declare a variable of type auto, the type itself being deduced from the variable’s initializer expression. The auto keyword is treated as a simple type specifier (that can be used with * and &), and its semantics are deduced from the initializer expression.

auto-typed Variables Examples

int IntFnc() {}
bool BoolFunc() {}
char* CharSFunc() {}
    
int _tmain(int argc, _TCHAR* argv[]) 
{
    // x is int
    auto x = IntFunc();
    // y is const bool
    const auto y = BoolFunc();
    // w is char*
    auto w = CharSFunc();

    return 0;
}

Multi-declarator auto

The C++11 standard includes the multi-variable form of auto declarations, such as:

int* func(){}

int _tmain(int argc, _TCHAR* argv[])
{
        auto x = 3, * y = func(), z = 4;
        return 0;
}

The restriction with multi-declarator auto expressions is that the variables must have the same base type. For example, the following line of code is well-formed:

auto x = 3, y = *(new int);

because x and y have the same base type : int, while the following code:

auto x = 3, y = 3.5;

will generate the error: [bcc64 Error] File1.cpp(11): 'auto' deduced as 'int' in declaration of 'x' and deduced as 'double' in declaration of 'y'. This feature is supported by the Clang-enhanced C++ compilers.

Check out all of the modern C++ language features supported in the latest C++Builder for Windows development.

Trending Stories

  • Get These Visually Stunning FireMonkey Styles Free To Enhance User...

  • VCL Styles: Master The Secrets Of Beautiful Modern Apps In...

  • grep for Delphi .dproj file containing copy commands for certain...

  • Powerful Cross Platform Multitrack Music Recording Software Built In Delphi...

  • Ultra-Fast Enterprise-Grade List And Label Reporting Tool For Delphi

Embarcadero GetIt

  • Trial - TMS Scripter

    Add the ultimate flexibility and power into your apps with native Pascal or Basic scripting and […]

  • Trial - TMS MQTT

    Cross-platform messaging client library implementing the full MQTT specification.

  • FMXLinux

    Full features FireMonkey implementation for Linux Platform.

  • Trial - TMS FMX Cloud Pack

    TMS FMX Cloud Pack is a Delphi and C++Builder component library to seamlessly use all major cloud […]

  • Trial - TMS FMX UI Pack

    Single-source fully cross platform component set for desktop and mobile application development for […]

  • Learn Delphi
  • Learn C++
  • Embarcadero Blogs
  • BeginEnd.net
  • Python GUI
  • Firebird News
  • Torry’s Delphi Pages
Copyright DelphiFeeds.com 2021. All Rights Reserved
Embarcadero
Login Register

Login

Lost Password

Register

Lost Password