1 00:00:01,250 --> 00:00:07,580 When you call a function, the compiler will create a stack frame for the new function call and it will 2 00:00:07,580 --> 00:00:10,130 push items onto the stack here. 3 00:00:10,130 --> 00:00:19,130 So the data itself that the data put on the stack depends on your compiler, the whether the code is 4 00:00:19,130 --> 00:00:22,130 compiled for the debug or the release build here. 5 00:00:22,220 --> 00:00:30,560 However, in general the will there will be information about the parameters passed here, the information 6 00:00:30,560 --> 00:00:37,760 pass parameters and to the function, the return address here and the address the named the function 7 00:00:37,760 --> 00:00:42,170 call here and the automatic variables are located in this function here. 8 00:00:42,170 --> 00:00:48,110 This means that when you make a function call at runtime there will be a memory overhead and performance 9 00:00:48,110 --> 00:00:55,070 overhead from creating this stack frame before the function runs and the performance overhead in when 10 00:00:55,070 --> 00:00:57,710 you clean this function up. 11 00:00:57,710 --> 00:00:59,660 So after the function completes here. 12 00:00:59,670 --> 00:01:06,170 So if a function is inline, this overhead does not occur because the function call will use the current 13 00:01:06,170 --> 00:01:08,150 stack frame rather than a new one. 14 00:01:08,150 --> 00:01:15,290 So clearly the inline function should be small, both in terms of code and the memory used on the stack 15 00:01:15,290 --> 00:01:15,650 here. 16 00:01:15,650 --> 00:01:24,380 So the compiler can ignore the inline specified and call the function with a separate stack frame. 17 00:01:24,380 --> 00:01:29,440 So we can actually specify the Cal conventions in this C++ here. 18 00:01:29,450 --> 00:01:37,280 So when your code uses your own functions, you do not need to pay any attention to calling conventions 19 00:01:37,280 --> 00:01:42,100 because the compiler will make sure that the appropriate convention is used. 20 00:01:42,110 --> 00:01:50,210 So however, if you are writing library code that can be used by other C++ compilers or even by other 21 00:01:50,210 --> 00:01:53,750 languages, the Colin Convention becomes important. 22 00:01:53,750 --> 00:01:57,350 So science discourse is not about interoperable code. 23 00:01:57,380 --> 00:02:04,940 We won't go into much step here, but instead we will look at two aspects function naming and stack 24 00:02:04,940 --> 00:02:05,840 maintenance. 25 00:02:06,730 --> 00:02:09,430 So we can also use the Sea Lancashire. 26 00:02:09,730 --> 00:02:16,450 So when you give a C++ function a name, this is the name that you will use to call the function in 27 00:02:16,450 --> 00:02:18,130 your C++ code. 28 00:02:18,160 --> 00:02:25,210 However, under the covers, the C++ compiler will decorate the name with the extra symbols for the 29 00:02:25,210 --> 00:02:31,940 return type and the parameter so that the overloaded functions all have different names. 30 00:02:31,960 --> 00:02:41,480 So to the C++ developers, it is also known as the name Mangling Mangling. 31 00:02:41,500 --> 00:02:48,190 So if you need to export a function through the shared library, for example, in Windows Dynamic Linked 32 00:02:48,190 --> 00:02:54,190 Library, this means that the files for the. 33 00:02:56,660 --> 00:03:07,790 Shared library library in windows here that the WL files here so this means dynamic linked library so 34 00:03:07,790 --> 00:03:12,080 you must use the types and names that the other languages can use. 35 00:03:12,080 --> 00:03:17,420 So to do this you can mark a function with the x ten c here. 36 00:03:17,420 --> 00:03:25,970 This means that the function has C linkage and the compiler will not use the external code and you should 37 00:03:26,930 --> 00:03:34,670 not use it with the function to have a return values and parameters that use the C plus plus custom 38 00:03:34,670 --> 00:03:35,120 steps. 39 00:03:35,120 --> 00:03:36,590 External C here. 40 00:03:36,590 --> 00:03:37,340 Like that. 41 00:03:37,520 --> 00:03:38,570 So. 42 00:03:39,890 --> 00:03:46,760 However, if such function does return a C++ type, the compiler will only use a warning. 43 00:03:46,790 --> 00:03:54,590 The reason is that the C is a flexible language and the C programmer will be able to work out how to 44 00:03:54,590 --> 00:03:57,930 turn the C++ type into something usable. 45 00:03:57,950 --> 00:04:01,910 But it's poor practice to abuse them like this here.