Sponsored Content
Top Forums Programming Parameter passing to function with void * as Argument Post 302903247 by Corona688 on Monday 26th of May 2014 11:23:57 AM
Old 05-26-2014
Quote:
Originally Posted by alister
I would suggest using a tagged union and leaving the initial structs as they were:
Bad advice! Very dangerous! Unions do not work that way!

If you don't add the 'type' value to the structures, then it won't work properly in the union! It will refer to some other member.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Passing Argument to Function

May i know how to pass an argument to a function in a shell script? Sorry, i din stated that it is in a shell script in my previous post. Means: checkStatus() { ........... } read status; I wanna use the status in the function checkstatus, how... (2 Replies)
Discussion started by: AkumaTay
2 Replies

2. Shell Programming and Scripting

Passing a string parameter to a function

I need to pass a parameter to a function in a script. My parameter is a string. When I display the parameter within my function, I only get the first word from string I pass in. How can I make the function receive the whole string (and not terminate at the first space it encounters)?. part of... (1 Reply)
Discussion started by: fastgoon
1 Replies

3. UNIX for Advanced & Expert Users

Parameter passing in a function

I need to pass a parameter to a function in a script. My parameter is a string. When I display the parameter within my function, I only get the first word from string I pass in. How can I make the function receive the whole string (and not terminate at the first space it encounters)?. part of... (2 Replies)
Discussion started by: fastgoon
2 Replies

4. Programming

How to return void function pointer

Hello all im trying to build function that will return void function pointer what is mean is ( not working ) the main function void * myClass::getFunction(int type){ if(type==1) return &myClass::Test1; if(type==2) return &myClass::Test2; } void myClass::Test1(){... (1 Reply)
Discussion started by: umen
1 Replies

5. Shell Programming and Scripting

Passing more than one argument in a function

Hi All, Calling a function with one argument and storing the return value in a shell script is as below:( so far I know) value="`fun_1 "argument1"`" Its working perfectly for me. Can u help me with passing more than one argument and storing the return value Thnaks in advance JS (1 Reply)
Discussion started by: jisha
1 Replies

6. Shell Programming and Scripting

Passing commandline argument to a function

Hi, I have 2 ksh scripts. Script1.ksh contains function definition. script1.ksh function f1() { while getopts a:c: args do case $args in a) ARG1=$OPTARG ;; c) ARG2=$OPTARG ;; \?) echo "Error no valid Arguments passed" esac done echo $ARG1 echo $ARG2 script2.sh (2 Replies)
Discussion started by: siba.s.nayak
2 Replies

7. Shell Programming and Scripting

Passing sql as parameter to unix function

Hi, I have a function which connects to the db and runs the sql. it works fine when I run it like: function "select empname from emp;" but when I try to pass the sql string to a variable which in turn in fed to the function , it throws error. please advise. Thanks, Arnie. (1 Reply)
Discussion started by: itsarnie
1 Replies

8. Shell Programming and Scripting

passing argument from one function to another

Hi all, In the given script code . I want to pass the maximum value that variable "i" will have in function DivideJobs () to variable $max of function SubmitCondorJob(). Any help? Thanks #!/bin/bash ... (55 Replies)
Discussion started by: nrjrasaxena
55 Replies

9. Shell Programming and Scripting

Passing parameter to script, and split the parameter

i am passing input parameter 'one_two' to the script , the script output should display the result as below one_1two one_2two one_3two if then echo " Usage : <$0> <DATABASE> " exit 0 else for DB in 1 2 3 do DBname=`$DATABASE | awk -F "_" '{print $1_${DB}_$2}` done fi (5 Replies)
Discussion started by: only4satish
5 Replies

10. Shell Programming and Scripting

Passing command as a function parameter

Hi All, Just trying to implement the below shell script using AIX ksh shell. myfunc { eval "$*" } CMD='ls -la /etc/hosts | awk '{print $9"|"$5}'' myfunc $CMD Keeping getting "|}: not found" errors, any pointers would greatly be appreciated. Kind Regards Ed Please... (2 Replies)
Discussion started by: eo29
2 Replies
Moose::Meta::TypeConstraint::Union(3)			User Contributed Perl Documentation		     Moose::Meta::TypeConstraint::Union(3)

NAME
Moose::Meta::TypeConstraint::Union - A union of Moose type constraints VERSION
version 2.0604 DESCRIPTION
This metaclass represents a union of type constraints. A union takes multiple type constraints, and is true if any one of its member constraints is true. INHERITANCE
"Moose::Meta::TypeConstraint::Union" is a subclass of Moose::Meta::TypeConstraint. Moose::Meta::TypeConstraint::Union->new(%options) This creates a new class type constraint based on the given %options. It takes the same options as its parent. It also requires an additional option, "type_constraints". This is an array reference containing the Moose::Meta::TypeConstraint objects that are the members of the union type. The "name" option defaults to the names all of these member types sorted and then joined by a pipe (|). The constructor sets the implementation of the constraint so that is simply calls "check" on the newly created object. Finally, the constructor also makes sure that the object's "coercion" attribute is a Moose::Meta::TypeCoercion::Union object. $constraint->type_constraints This returns the array reference of "type_constraints" provided to the constructor. $constraint->parent This returns the nearest common ancestor of all the components of the union. $constraint->check($value) $constraint->validate($value) These two methods simply call the relevant method on each of the member type constraints in the union. If any type accepts the value, the value is valid. With "validate" the error message returned includes all of the error messages returned by the member type constraints. $constraint->equals($type_name_or_object) A type is considered equal if it is also a union type, and the two unions have the same member types. $constraint->find_type_for($value) This returns the first member type constraint for which "check($value)" is true, allowing you to determine which of the Union's member type constraints a given value matches. $constraint->is_a_type_of($type_name_or_object) This returns true if all of the member type constraints return true for the "is_a_type_of" method. $constraint->is_subtype_of This returns true if all of the member type constraints return true for the "is_a_subtype_of" method. $constraint->create_child_type(%options) This returns a new Moose::Meta::TypeConstraint object with the type as its parent. BUGS
See "BUGS" in Moose for details on reporting bugs. AUTHOR
Moose is maintained by the Moose Cabal, along with the help of many contributors. See "CABAL" in Moose and "CONTRIBUTORS" in Moose for details. COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Infinity Interactive, Inc.. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.16.2 2012-09-19 Moose::Meta::TypeConstraint::Union(3)
All times are GMT -4. The time now is 05:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy