03-30-2014
Quote:
The model you don't seem to like overcomes this issue. You no longer need to worry about the order of functions written in your code when you create function "prototypes". And place them near the start of the source file, before any function code.
.
First off. thanks for the reply, it does make sense, but when you say this.. placing the prototype of the function before the main function. When I declare and define the function doesn't that accomplish the same thing as the prototype? Like if I have a list of prototypes before main, and then they are defined at the end of the file...I'm not seeing how that's different than having a list AND definition in the beginning of the file? Don't they accomplish the same thing?
8 More Discussions You Might Find Interesting
1. Programming
in the header file orville.h, outside of the #ifdef #endif , there is the following
#define JOB_CONTROL /* support job-control */
As you can see, the JOB_CONTROL macro has no value associated with it. Here is what I go when I ran grep on the entire source code.
$ grep -iR... (6 Replies)
Discussion started by: frequency8
6 Replies
2. UNIX for Dummies Questions & Answers
Hi friends,
I am not sure if perl questions can be raised here. :rolleyes:
But I have a doubt if there is a way to do "#define" in perl, like in C.
Does anyone know if it is feasible (without CPAN modules)?
Thanks,
Srini (7 Replies)
Discussion started by: srinivasan_85
7 Replies
3. Programming
Hello,
I would like to conditionaly comment in my code source some fields from arrays. So I use the property ## from the #define definition.
my code:
...
#define slet /##*
#define etsl *##/
...
const T_SVT_ADLL_A653_DESC A_DESC =
{
{ slet qwerty etsl SLICING,... (3 Replies)
Discussion started by: cypleen
3 Replies
4. Programming
if i do this in C
#define NUM 1234512345
then how come i cant print it out using
int main(int argc, char **argv) {
printf("%d\n", NUM);
return 0;
}
well the result is -1219236538, why isnt it 1234512345 ? (7 Replies)
Discussion started by: omega666
7 Replies
5. Programming
Hi,
I had a head file, looks like
#define MIN_NUM 10
#define MAX_NUM 10
is there any way to get "MAX_NUM" from 10?
thanks.
peter (9 Replies)
Discussion started by: laopi
9 Replies
6. Shell Programming and Scripting
I have 7 functions those need to be executed as command line inputs, I tried with below code it’s not executing function. If I run the ./script 2 then fun2 should execute , how to initiate that function I tried case and if else also, how to initiate function from command line
if
then... (8 Replies)
Discussion started by: saku
8 Replies
7. Shell Programming and Scripting
HI
I have file A.txt
_1A
_2A
_3A
_4A
I want define all as different variable.
$1A=_1A
$2B=_2A
$3C=_3A
$4D=_4A
Now i can use any variable in my script. (3 Replies)
Discussion started by: pareshkp
3 Replies
8. Shell Programming and Scripting
Hi,
I just define the variable in script and use those script in another script but the variable not recognize.
test1.sh
#!/bin/bash
DB="test_db"
USR="test_user"
PWD="test_pwd"
HST="24.254.87.12"
test2.sh
#!/bin/bash
./test1.sh
mysql -u $USR -p $PWD -h $HST... (2 Replies)
Discussion started by: fspalero
2 Replies
LEARN ABOUT MOJAVE
ppi::token::prototype
PPI::Token::Prototype(3) User Contributed Perl Documentation PPI::Token::Prototype(3)
NAME
PPI::Token::Prototype - A subroutine prototype descriptor
INHERITANCE
PPI::Token::End
isa PPI::Token
isa PPI::Element
SYNOPSIS
sub ($@) prototype;
DESCRIPTION
Although it sort of looks like a list or condition, a subroutine prototype is a lot more like a string. Its job is to provide hints to the
perl compiler on what type of arguments a particular subroutine expects, which the compiler uses to validate parameters at compile-time,
and allows programmers to use the functions without explicit parameter braces.
Due to the rise of OO Perl coding, which ignores these prototypes, they are most often used to allow for constant-like things, and to
"extend" the language and create things that act like keywords and core functions.
# Create something that acts like a constant
sub MYCONSTANT () { 10 }
# Create the "any" core-looking function
sub any (&@) { ... }
if ( any { $_->cute } @babies ) {
...
}
METHODS
This class provides one additional method beyond those defined by the PPI::Token and PPI::Element parent classes.
prototype
The "prototype" accessor returns the actual prototype pattern, stripped of braces and any whitespace inside the pattern.
SUPPORT
See the support section in the main module.
AUTHOR
Adam Kennedy <adamk@cpan.org>
COPYRIGHT
Copyright 2001 - 2011 Adam Kennedy.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
perl v5.18.2 2011-02-25 PPI::Token::Prototype(3)