First off, compile with gcc -Wall then it won't happen again if you pay attention to warnings. A good compile is zero warnings and zero errors, nothing else is acceptable.
When a function returns an int and nothing is returned by the function - then - whatever garbage data was living on the stack is what gets returned. ie., any value is possible. If your code looks like
Then any garbage on the stack will result in a "good" return. This is called programming by coincidence, in polite circles, when it actually works.
I have two string returning function in ESQL/C
char *segment_name(lbuffer)
char *lbuffer;
{.....
and
char *get_bpdvalue(f_name)
char *f_name;
{......
both declared above main()
char *get_bpdvalue();
char *segment_name();
my problem is segment_name works on sprintf and strcpy... (5 Replies)
Hi all,
I am very new to BASH shell programming. I need to return an integer from a function to the caller function. I did this:
but it keeps giving me wrong return:
Can someone help me out here, please?
Thanks (2 Replies)
Hi All
In my script, I can call on several functions. I have a logging function that is called by any of these functions. What I would like is some way of identifying which function I am using and pass this to the log function as some parameter.
Is there some built in command or way of... (3 Replies)
Guys - Simple code, i am trying to get a number back from sqlplus call to a query. After that, i need to use that number in a loop.
---------------------------------
#!/bin/ksh
VALUE=`sqlplus -silent sh/password@sh <<END
set pagesize 0 feedback off verify off heading off echo off
select... (10 Replies)
Hi,
If I have a code like this, what are the potential problems do you see?
const char* const retString() {
return "hello"; /* string literal */
}
My questions are:
a) Since the string literal which is already a constant read only data (cannot be... (4 Replies)
Hi
I am pretty confused in returning and capturing multiple values
i have defined a function which should return values "total, difference"
i have used as
#!/usr/bin/ksh
calc()
{
total=$1+$2
echo "$total"
diff=$2-$1
echo "$diff"
}
I have invoked this function as
calc 5 8
Now i... (2 Replies)
Not sure where the problem is. I can run the script without any issue using the following command.
. /opt/app/scripts/cdc_migration.sh
But it fails with the below error when I try it this way
/opt/app/scripts/cdc_migration.sh
/opt/app/scripts/cdc_migration.sh: line 65: return: can only... (1 Reply)
Hi All,
Good Day, seeking for your assistance on how to not perform my 2nd, 3rd,4th etc.. function if my 1st function is in else condition.
#Body
function1()
{
if
then
echo "exist"
else
echo "not exist"
}
#if not exist in function1 my all other function will not proceed.... (4 Replies)
Discussion started by: meister29
4 Replies
LEARN ABOUT CENTOS
papi_event_name_to_code
PAPI_event_name_to_code(3) PAPI PAPI_event_name_to_code(3)NAME
PAPI_event_name_to_code -
Convert a name to a numeric hardware event code.
SYNOPSIS Detailed Description
@par C Interface:
int PAPI_event_name_to_code( char * EventName, int * EventCode );
PAPI_event_name_to_code is used to translate an ASCII PAPI event name
into an integer PAPI event code.
@param *EventCode
The numeric code for the event.
@param *EventName
A string containing the event name as listed in PAPI_presets or discussed in PAPI_native.
@retval PAPI_EINVAL
One or more of the arguments is invalid.
@retval PAPI_ENOTPRESET
The hardware event specified is not a valid PAPI preset.
@retval PAPI_ENOINIT
The PAPI library has not been initialized.
@retval PAPI_ENOEVNT
The hardware event is not available on the underlying hardware.
@par Examples:
* int EventCode, EventSet = PAPI_NULL;
* // Convert to integer
* if ( PAPI_event_name_to_code( "PAPI_TOT_INS", &EventCode ) != PAPI_OK )
* handle_error( 1 );
* // Create the EventSet
* if ( PAPI_create_eventset( &EventSet ) != PAPI_OK )
* handle_error( 1 );
* // Add Total Instructions Executed to our EventSet
* if ( PAPI_add_event( EventSet, EventCode ) != PAPI_OK )
* handle_error( 1 );
*
See Also:
PAPI_event_code_to_name
PAPI_remove_event
PAPI_get_event_info
PAPI_enum_event
PAPI_add_event
PAPI_add_named_event
PAPI_presets
PAPI_native
Author
Generated automatically by Doxygen for PAPI from the source code.
Version 5.2.0.0 Tue Jun 17 2014 PAPI_event_name_to_code(3)