element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Code Exchange
  • Technologies
  • More
Code Exchange

Blog

  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Code Exchange to participate - click to join for free!

Blog

  • Tags
  • Subscribe by email
  • More
  • Cancel
  • modern C++: write my own function that returns true / false, and a value, part 2 (embedded friendly)

    Jan Cumps
    Jan Cumps
    what came before:  modern C++: function returns true / false, and a value or error message   modern C++: write my own function that returns true / false, and a value or error message  C++ has released a new feature: return ...
    • 4 Dec 2025
  • modern C++: initialise a static array inside a class

    Jan Cumps
    Jan Cumps
    Pre C++17 In traditional C++, if you have a class that has a static array as data member, you have to initialise that array outside of the class.  class myclass { protected: static uint myarray[4]; }; uint myclass::myarray[4]; You will typi...
    • 24 Nov 2025
  • Monitor your IDEC PLC with Maintenance Protocol using the open source library FC6A

    SensoredHacker0
    SensoredHacker0
    Maybe you work with IDEC PLCs, or maybe you have to monitor a process using them. Well, from WindLDR, that process might suck, having to monitor trends, or open multiple instances of WindLDR just to look at some select registers, there is now a ...
    • 23 Nov 2025
  • Generate Awesome ASCII ART with QAAA.py

    SensoredHacker0
    SensoredHacker0
    Hello All from rural Maine. QAAA.py is a novel drawing app, which uses  text to draw pictures. Some of y'all might have been around at a time when ASCII text was more prevalent. Well anyway, this app is designed to be cross platform tho...
    • 22 Nov 2025
  • C++ write your own stream class - part 1a: the cost of objects can be zero (embedded friendly C++)

    Jan Cumps
    Jan Cumps
    I wrote a little output stream class in a previous post:  C++ write your own stream class - part 1: output stream initial design (embedded friendly C++) . In this post, I'm adding an input stream, and an input / output stream that's su...
    • 12 Nov 2025
  • C++ write your own stream class - part 1: output stream initial design (embedded friendly C++)

    Jan Cumps
    Jan Cumps
    In C++ it's common to stream data. You write to a file using the << operator. example:  cout << "hello, world! << endl; In this blog I'm making my own minimal output stream class. Just enough code to show that it works. This co...
    • 11 Nov 2025
  • modern C++ for loop, but you still want an index

    Jan Cumps
    Jan Cumps
    C++ has a range loop. A for loop that will run over all elements in the range you give it: std::vector<int> v = {0, 1, 2, 3, 4, 5}; // ... for (auto i : v) std::cout << i << ' '; std::cout << '\n&#...
    • 5 Nov 2025
  • Reflections on Using AI in Software Development

    AngelSoto
    AngelSoto
    Context: A Practical Project Over the past days, I have been developing a Python Qt application to generate weekly meal plans for my baby and family.The project itself is not overly complex, but it has provided a valuable opportunity to reflect on so...
    • 11 Sep 2025
  • C++ moving and returning objects part 2: move and copy (embedded friendly C++)

    Jan Cumps
    Jan Cumps
    In object oriented designs, there are times when you replace an object by another. Example: when you store an object into an STL container. In a lot of those cases, you create an object, and add it. The object in the container is a cop...
    • 20 Jul 2025
  • C++ moving and returning objects part 1: object as return value (embedded friendly C++)

    Jan Cumps
    Jan Cumps
    You may read guidelines that say: "never use an object as return value of a function. Because of performance reasons". Because the object is copied into the receiving variable when returning from the function call. That was true in C++...
    • 19 Jul 2025
  • C++ 3 way compare

    Jan Cumps
    Jan Cumps
    task: Let's say that you are writing a C++ class, where the objects have to be sorted or compared. In classic C++, you 'd write an operator overload for <, <=, == , !=, >= and >. In modern C++, you can get all that fun...
    • 15 Jul 2025
  • GCC 15.1 for Windows is available

    Jan Cumps
    Jan Cumps
    If you're interested to try out the latest C++26 options: The Windows port for GCC 15.1 is available for download.I installed GCC 15.1.0 (with POSIX threads) + MinGW-w64 13.0.0 UCRT - release 2. To install, download the zip file, ...
    • 30 Jun 2025
  • C++ friend functions

    Jan Cumps
    Jan Cumps
    For an embedded design, I made a featherweight class. A C++ construct that used no more data or code size than a traditional C design. class command { public: inline command(uint32_t steps, bool reverse) : cmd_(steps << 1 |...
    • 18 May 2025
  • New CMake library link option $<COMPILE_ONLY:LIB>

    Jan Cumps
    Jan Cumps
    CMake has an easy way to get access to libraries headers and source: target_link_libraries(your_lib, some_lib). Where your_lib is the library you are developing, and some_lib is a library you depend on. Ideal if you are using a library, and...
    • 19 Apr 2025
  • embedded C++: manage a resource with a tiny* object

    Jan Cumps
    Jan Cumps
    *tiny like in: 0 bits of data, 0 code instructions added, 0 clock ticks scenario: you have a resource that needs to be initialised before use, and deactivated when done. We usually do that by calling some code before the actions, and some code after ...
    • 5 Apr 2025
  • embedded C++: add cheap bitwise conversion to a register structure

    Jan Cumps
    Jan Cumps
    This blog is based on real world work. I'm controlling a TI DRV8711 stepper motor controller via SPI. I need to modify 16-bit registers of that IC. TI provided a header file with register definitions, and code to convert that struct to a 16 bit ...
    • 30 Mar 2025
  • modern C++: restrict templated types with concept

    Jan Cumps
    Jan Cumps
    In C++, templates allow you to write generic code, that can handle many types. But almost always, there will be types you can't handle. In my case, I have a callback manager that supports functions that return a void, a number, a bool or a class...
    • 10 Mar 2025
  • C++ classes and operators

    Jan Cumps
    Jan Cumps
    This is a "classic C++" post, something that's been part of the language since conception: How to use an operator in your class design. I developed a callback class. Your "gizmo that needs to callback something" would hold an instance of that class (...
    • 9 Mar 2025
  • let CMake fetch your build dependencies

    Jan Cumps
    Jan Cumps
    When you work on a project, you often rely on external libraries and source code. If you use CMake as your build tool: it can download the artifacts for you. And make them available during build. By using FetchContent. use case: your pro...
    • 9 Mar 2025
  • modern C++: write my own function that returns true / false, and a value or error message - part 1 (embedded friendly)

    Jan Cumps
    Jan Cumps
    I'm experimenting with new C++ constructs. GCC 15 implements an interesting concept of the C++26 standard: A function can return a status, and either a value or an error message. In a previous post I tested one of C++ standard function...
    • 1 Mar 2025
  • modern C++: function returns true / false, and a value or error message

    Jan Cumps
    Jan Cumps
    I'm experimenting with new C++ constructs. GCC 15 implements an interesting concept of the C++26 standard: A function can return a status, and either a value or an error message.Example is the standard std::to_chars() function. It...
    • 1 Mar 2025
  • built gcc 15 daily release from source

    Jan Cumps
    Jan Cumps
    The latest GCC version is 14.2.1. I want to try out new GCC 15 features. I followed these instructions to build the toolchain from source: https://askubuntu.com/questions/1513160/how-to-install-gcc-14-on-ubuntu-22-04-and-24-04. They transla...
    • 1 Mar 2025
  • modern C++ modules: convert existing example from .h to module

    Jan Cumps
    Jan Cumps
    I'm experimenting with new C++ constructs.  In  C++ callbacks and templates , I developed a generic object oriented callback handler using templates.In modern C++ modules I tried out an example that uses C++ modules...
    • 8 Feb 2025
  • modern C++ modules

    Jan Cumps
    Jan Cumps
    Since C++20, a new feature is available: modules. We're all used to C++ header and source files. And we all know their pros and cons. Because I'm reviewing a new C++ alternative for them, I'll focus on the cons of header files: header file...
    • 2 Dec 2024
  • sensible C++ coding convention - µOS naming standard

    Jan Cumps
    Jan Cumps
    When writing reusable code, I like to be consistent and use standards. For C++, there are many flavours out there. I've been looking around for guidance on writing modern C++ code, with templates. That's when I bumped into the µOS naming s...
    • 1 Sep 2024
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube