Sponsored Content
Full Discussion: c calling conventions
Top Forums Programming c calling conventions Post 302431989 by jim mcnamara on Wednesday 23rd of June 2010 11:34:19 AM
Old 06-23-2010
Order of evaluation of function arguments is not defined. In fact it is a portability problem. The only thing that can be said is that the arguments will have been fully evaluated (it is a sequence point) before the arguments are passed to the called function.

BEB's example is a disaster waiting to happen.

By calling conventions do you mean _CDECL and _STDCALL? That is independant of the example given in the above post. Order of evaluation and the order arguments are pushed is not necessarily related.
This User Gave Thanks to jim mcnamara For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Calling a script from another

Hi, I have 2 scripts, one is the .profile and the other is a SID selector for Oracle Databases. But when I call one from the other, even though it seems to have worked, it doesn't. Can anyone help?? ******************* .profile********************** #!/bin/ksh .... (5 Replies)
Discussion started by: dnkansah
5 Replies

2. Shell Programming and Scripting

Get Calling File

OK, I'm very new to shell scripting, and I'm trying to write a (very) simple wrapper for sendmail that outputs all the arguments as well as the file that called sendmail to an output file which can later be looked over. Is it possible to get a file's name and path that called a script? (0 Replies)
Discussion started by: ghstber
0 Replies

3. UNIX for Advanced & Expert Users

Naming conventions for shared libraries in Linux

Hello, I'm wondering what is the naming conventions for *.so shared libraries in linux. For example, a library in /lib, say libcrypt-2.7.so has a symbolic link called libcrypt.so.1 pointing to it, yet libncursesw.so.5.6 has a symbolic link called libncursesw.so.5 pointing to it. What is the... (2 Replies)
Discussion started by: neked
2 Replies

4. Solaris

A query on Disk naming conventions in Solaris.

These are findings by me with my little experience with Solaris 10. Please correct me if wrong.. In x86 systems with ide hard disk: c= controller d=disk s=slice 1.Here controller c0 means the primary ide controller ide0. controller c1 means the secondary ide controller ide1. ... (5 Replies)
Discussion started by: saagar
5 Replies

5. UNIX for Dummies Questions & Answers

CSS coding conventions checker

I would like to use an automated checker for adherence to CSS coding conventions. I have browsed the web, but no tool I came across checks for coding conventions, only syntax. Here is a general list of requirements: - Style definitions should be separated by one blank line - Indentation is 2... (0 Replies)
Discussion started by: figaro
0 Replies

6. UNIX for Dummies Questions & Answers

question about man font conventions

i was viewing the gawk's man file,checked the man faqs,didnt find anything about the char "e" meaning .TP .B \e` matches the empty string at the beginning of a buffer (string). .TP .B \e' matches the empty string at the end of a buffer.after convention,it should looks like thie \` ... (2 Replies)
Discussion started by: b33713
2 Replies

7. UNIX for Dummies Questions & Answers

Typographic conventions in bash 4.2

is there a typographic convention that is followed in the man pages. where could a description be found. at this time i am in man stty and the author uses upper case in some places. and my brain is just burning to a fizzle while studying a book on bash and trying to stay in scope of the... (1 Reply)
Discussion started by: cowLips
1 Replies

8. Shell Programming and Scripting

How does calling it .sh help?

Hi. I have been running some scripts ok with no extension on the name, and they work fine. What difference does it make if I call them whatever.sh? And I have some scripts starting #!/bin/bash - which debian recognises as shell scritps, even without the .sh ending - and some which don't. I'm sure... (8 Replies)
Discussion started by: triplemaya
8 Replies

9. Cybersecurity

Proper naming conventions

Hey guys, not sure should I post it here or in 'What is on Your Mind?' I'm discussing usage of DSL (domain specific language) in security tools with my colleagues. We haven't been able to reach an agreement over naming conventions. There are many tools using DSL: splunk, sumologic,... (2 Replies)
Discussion started by: Tobby P
2 Replies

10. Linux

UNIX Utility Development Conventions?

I'm slowly hacking away at a zsh script that shows some promise as a command line tool. I want to learn more about the conventions regarding command line tool development in Unix (and/or macOS), but don't really know where to look for this information. What is the correct way, or convention, to... (2 Replies)
Discussion started by: MonilGomes
2 Replies
erl_eval(3erl)						     Erlang Module Definition						    erl_eval(3erl)

NAME
erl_eval - The Erlang Meta Interpreter DESCRIPTION
This module provides an interpreter for Erlang expressions. The expressions are in the abstract syntax as returned by erl_parse , the Erlang parser, or a call to io:parse_erl_exprs/2 . EXPORTS
exprs(Expressions, Bindings) -> {value, Value, NewBindings} exprs(Expressions, Bindings, LocalFunctionHandler) -> {value, Value, NewBindings} exprs(Expressions, Bindings, LocalFunctionHandler, NonlocalFunctionHandler) -> {value, Value, NewBindings} Types Expressions = as returned by erl_parse or io:parse_erl_exprs/2 Bindings = as returned by bindings/1 LocalFunctionHandler = {value, Func} | {eval, Func} | none NonlocalFunctionHandler = {value, Func} | none Evaluates Expressions with the set of bindings Bindings , where Expressions is a sequence of expressions (in abstract syntax) of a type which may be returned by io:parse_erl_exprs/2 . See below for an explanation of how and when to use the arguments LocalFunc- tionHandler and NonlocalFunctionHandler . Returns {value, Value, NewBindings} expr(Expression, Bindings) -> { value, Value, NewBindings } expr(Expression, Bindings, LocalFunctionHandler) -> { value, Value, NewBindings } expr(Expression, Bindings, LocalFunctionHandler, NonlocalFunctionHandler) -> { value, Value, NewBindings } expr(Expression, Bindings, LocalFunctionHandler, NonlocalFunctionHandler, ReturnFormat) -> { value, Value, NewBindings } | Value Types Expression = as returned by io:parse_erl_form/2, for example Bindings = as returned by bindings/1 LocalFunctionHandler = {value, Func} | {eval, Func} | none NonlocalFunctionHandler = {value, Func} | none ReturnFormat = value | none Evaluates Expression with the set of bindings Bindings . Expression is an expression (in abstract syntax) of a type which may be returned by io:parse_erl_form/2 . See below for an explanation of how and when to use the arguments LocalFunctionHandler and Nonlo- calFunctionHandler . Returns {value, Value, NewBindings} by default. But if the ReturnFormat is value only the Value is returned. expr_list(ExpressionList, Bindings) -> {ValueList, NewBindings} expr_list(ExpressionList, Bindings, LocalFunctionHandler) -> {ValueList, NewBindings} expr_list(ExpressionList, Bindings, LocalFunctionHandler, NonlocalFunctionHandler) -> {ValueList, NewBindings} Evaluates a list of expressions in parallel, using the same initial bindings for each expression. Attempts are made to merge the bindings returned from each evaluation. This function is useful in the LocalFunctionHandler . See below. Returns {ValueList, NewBindings} . new_bindings() -> BindingStruct Returns an empty binding structure. bindings(BindingStruct) -> Bindings Returns the list of bindings contained in the binding structure. binding(Name, BindingStruct) -> Binding Returns the binding of Name in BindingStruct . add_binding(Name, Value, Bindings) -> BindingStruct Adds the binding Name = Value to Bindings . Returns an updated binding structure. del_binding(Name, Bindings) -> BindingStruct Removes the binding of Name in Bindings . Returns an updated binding structure. LOCAL FUNCTION HANDLER
During evaluation of a function, no calls can be made to local functions. An undefined function error would be generated. However, the optional argument LocalFunctionHandler may be used to define a function which is called when there is a call to a local function. The argu- ment can have the following formats: {value,Func} : This defines a local function handler which is called with: Func(Name, Arguments) Name is the name of the local function (an atom) and Arguments is a list of the evaluated arguments. The function handler returns the value of the local function. In this case, it is not possible to access the current bindings. To signal an error, the function handler just calls exit/1 with a suitable exit value. {eval,Func} : This defines a local function handler which is called with: Func(Name, Arguments, Bindings) Name is the name of the local function (an atom), Arguments is a list of the unevaluated arguments, and Bindings are the current vari- able bindings. The function handler returns: {value,Value,NewBindings} Value is the value of the local function and NewBindings are the updated variable bindings. In this case, the function handler must itself evaluate all the function arguments and manage the bindings. To signal an error, the function handler just calls exit/1 with a suitable exit value. none : There is no local function handler. NON-LOCAL FUNCTION HANDLER The optional argument NonlocalFunctionHandler may be used to define a function which is called in the following cases: a functional object (fun) is called; a built-in function is called; a function is called using the M:F syntax, where M and F are atoms or expressions; an oper- ator Op/A is called (this is handled as a call to the function erlang:Op/A ). Exceptions are calls to erlang:apply/2,3 ; neither of the function handlers will be called for such calls. The argument can have the following formats: {value,Func} : This defines an nonlocal function handler which is called with: Func(FuncSpec, Arguments) FuncSpec is the name of the function on the form {Module,Function} or a fun, and Arguments is a list of the evaluated arguments. The function handler returns the value of the function. To signal an error, the function handler just calls exit/1 with a suitable exit value. none : There is no nonlocal function handler. Note: For calls such as erlang:apply(Fun, Args) or erlang:apply(Module, Function, Args) the call of the non-local function handler corresponding to the call to erlang:apply/2,3 itself-- Func({erlang, apply}, [Fun, Args]) or Func({erlang, apply}, [Module, Function, Args]) --will never take place. The non-local function handler will however be called with the evaluated arguments of the call to erlang:apply/2,3 : Func(Fun, Args) or Func({Module, Function}, Args) (assuming that {Module, Function} is not {erlang, apply} ). Calls to functions defined by evaluating fun expressions "fun ... end" are also hidden from non-local function handlers. The nonlocal function handler argument is probably not used as frequently as the local function handler argument. A possible use is to call exit/1 on calls to functions that for some reason are not allowed to be called. BUGS
The evaluator is not complete. receive cannot be handled properly. Any undocumented functions in erl_eval should not be used. Ericsson AB stdlib 1.17.3 erl_eval(3erl)
All times are GMT -4. The time now is 08:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy