builtin

What does shift() do in Perl?

what could this line possibly mean? my $x = shift ; ...

What's the point of strspn?

At work today we were trying to come up with any reason you would use strspn. I searched google code to see if it's ever been implemented in a useful way and came up blank. I just can't imagine a situation in which I would really need to know the length of the first segment of a string that contains only characters from another string. ...

Distributing loadable builtin bash modules

I've written a built-in for bash which modifies the 'cd' command, a requirement for my software. Is there a way to actually distribute a loadable independently of bash itself? I'd ideally like to distribute just a drop in "additional feature" because I know people can be put off by patching and compiling their shell from source code. ...

How can I redefine 'open' properly in Perl?

Some time ago, I ask a question: How do I redefine built in Perl functions? And the answers have served me well. I have a package that overrides Perl's 'open' function enabling me to log file access. Now I've come to a case that breaks the functionality of the original code. use strict; use warnings; use Data::Dumper; sub myopen (*;@...

Is there a function to check if an object is a builtin data type?

I would like to see if an object is a builtin data type in C# I don't want to check against all of them if possible. That is, I don't want to do this: Object foo = 3; Type type_of_foo = foo.GetType(); if (type_of_foo == typeof(string)) { ... } else if (type_of_foo == typeof(in...

What is the difference between a language construct and a "built-in" function in PHP?

Hi guys, I know that include, isset, require, print, echo, and some others are not functions but language constructs. Some of these language constructs need parentheses, others don't. require 'file.php'; isset($x); Some have a return value, others do not. print 'foo'; //1 echo 'foo'; //no return value So what is the internal dif...

Inheriting directly from a built-in type versus its wrapper class in Python

Hi all, I'm currently reading Dive Into Python by Mark Pilgrim, and have gotten to the section on inheritance. In section 5.5, Pilgrim mentions the differences between inheriting from the wrapper class UserDict vs inheriting from the built-in dict type. I'm having trouble understanding why anyone would even bother with the wrapper cla...

How do I use gcc builtin __sync_bool_compare_and_swap in g++ on MacOSX?

I have some code that uses: __sync_bool_compare_and_swap it compiles fine on Linux. But when I try to compile it on MacOSX in g++, I get: error: ‘__sync_bool_compare_and_swap’ was not declared in this scope How do I fix this? (This is Mac OSX 10.5.8, so it's intel .. .and should have this instruction). Thanks! ...

Python Subclass Builtin List

Hi everyone, I want to subclass the list type and have slicing return an object of the descendant type, however it is returning a list. What is the minimum code way to do this? If there isn't a neat way to do it, I'll just include a list internally which is slightly more messy, but not unreasonable. Thank you! Edit: My code so far: c...

builtin iphone popups handling

Good Day! I have a question regarding iphone development. i am building an app for iphone which uses gps, i can tackle the gps from my app via alert that whether user wants to use gps or not. as you know when it will try to use gps, iphone's built in gps will ask as well whether to allow it to use or not. so here is my question that how...

Where can I find information about Perl's special variables?

Perl has quite a few special variables such as @F, $!, %! ... etc. Where are all Perl's special variables documented? ...

Python Profiling In Windows, How do you ignore Builtin Functions

I have not been capable of finding this anywhere online. I was looking to find out using a profiler how to better optimize my code, and when sorting by which functions use up the most time cumulatively, things like str(), print, and other similar widely used functions eat up much of the profile. What is the best way to profile a python ...

In Python, are there builtin functions for elementwise boolean operators over boolean lists?

For example, if you have n lists of bools of the same length, then elementwise boolean AND should return another list of that length that has True in those positions where all the input lists have True, and False everywhere else. It's pretty easy to write, i just would prefer to use a builtin if one exists (for the sake of standardizati...

How to find a value in array and remove it by using PHP array functions

How to find a value exist in an array and how to remove it. If any php builtin array functions for doing this. After removing I need the sequential index order. any body knows please help me. ...

How to determine the length of an array at compile time?

Are there macros or builtins that can return the length of arrays at compile time in GCC? For example: int array[10]; For which: sizeof(array) == 40 ???(array) == 10 Update0 I might just point out that doing this in C++ is trivial. One can build a template that returns the number inside []. I was certain that I'd once found a len...

MSVC equivalent to __builtin_popcount?

What is the equivalent to __builtin_popcount as found in GCC and Clang, for MSVC-10? ...