Skip to content

zoumson/FunctionArgumentsTemplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

LinkedIn

Function Arguments Template

ParametersReturn

Table of Contents
  1. About The Project
  2. Files Structure
  3. Getting Started
  4. Usage
  5. Roadmap
  6. Contributing
  7. License
  8. Contact
  9. Acknowledgements

About The Project

C++ functions exchange information by means of parameters and arguments. The term parameter refers to any declaration within the parentheses following the function name in a function declaration or definition; the term argument refers to any expression within the parentheses of a function call.

The following rules apply to parameters and arguments of C++ functions:

Except for functions with variable-length argument lists, the number of arguments in a function call must be the same as the number of parameters in the function definition. This number can be zero.

  • The maximum number of arguments (and corresponding parameters) is 253 for a single function.
  • Arguments are separated by commas. However, the comma is not an operator in this context, and the arguments can be evaluated by the compiler in any order. There is, however, a sequence point before the actual call.
  • Arguments are passed by value; that is, when a function is called, the parameter receives a copy of the argument's value, not its address. This rule applies to all scalar values, structures, and unions passed as arguments.move contructor can help reduce the duplication if the argument value is used only once.
  • Modifying a parameter does not modify the corresponding argument passed by the function call. However, because arguments can be addresses or pointers, a function can use addresses to modify the values of variables defined in the calling function.
  • In the old style, parameters that are not explicitly declared are assigned a default type of int .
  • The scope of function parameters is the function itself. Therefore, parameters of the same name in different functions are unrelated.

This project focus on regrouping the set of a arguments(over 253 parameters can be processed) of a function in a nutshell, let's say all, then assign each argument its value respectively as all.arg1=..; all.arg2=..; all.arg3=..; ...all.argn=..; within the function body/scope.

Built With



File Structure

Folders

Entire Files Structure

.
├── CMakeLists.txt
├── include
│   └── FctArgs.h
├── README.md
└── src
    └── Demo.cpp

Getting Started

This is a sample code of how you may regroup a function arguments in a class. To get a local copy up and running follow these simple steps.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • cmake
    sudo apt-get install cmake

Installation

  1. Clone the repo
    git clone https://github.com/zoumson/FunctionArgumentsTemplate.git
  2. Go to the project directory source
    cd FunctionArgumentsTemplate
  3. Create empty directories build, and bin
    mkdir build &&  mkdir bin 
  4. Generate the exectutable demo and move it to bin
    cd build && cmake .. && make && cd ..

Usage

  1. run
    ./bin/demo
  2. Output
Demo FctArgs template class
void function2Args(arg_2_is)
First arguemnt: 100
Second arguemnt: test 2 args
void function3Args(arg_3_isb)
First arguemnt: 5
Second arguemnt: test 3 args
Third arguemnt: 1
  1. Back to the initial file structure configuration
    rm -r bin build 

Roadmap

All the headers files are well docummented, read through the comments

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Adama Zouma - - stargue49@gmail.com

Project Link: https://github.com/zoumson/FunctionArgumentsTemplate

Acknowledgements

Releases

No releases published

Packages

No packages published