How about adding NEW Special Tokens?? For ease and Security
Matthew Ong
ongbp at yahoo.com
Wed May 25 07:23:35 PDT 2011
On 5/25/2011 9:45 PM, Daniel Gibson wrote:
>.stringof[7 .. $]
Belonging to which object or variable?
4) __BLOCKNAME__ // perhaps another name, but prints
>> class/struct/interface/template... name. If is global, print global.
How about this one? The class which the fuction belows
http://www.digitalmars.com/d/archives/digitalmars/D/FUNCTION_implemented_with_mixins_and_mangles_92055.html
---------------------------------------------------------------------------
> Use those functions (getuid(), getpid(), etc.) if you need those values.
>> Why make them look like compile-time special tokens?
>>
It would be even more cool if there is some immutable >RUNTIME< special
tokens:
Defining them as variable makes the code independent from
OS(win32/lin/OSX) API.
1) __LOGIN__ // Current user login id, eg: johnchia
2) __UID__ // User login number, eg: 0, 304,1234,...
3) __PID__ // Current program process id
4) __PPID__ // Parent process id
5) __STIME__ // Start time, date time,2011-02-23 14:45, to see if there
is a long over due program.
6) __CMDLINE__ // prints full path name C:\Program
Files\Notepad++\notepad.exe
7) __TOTMEM__ // Total amount of memory being used. Read Only, but dynamic.
8) __MAXMEM__ //
These runtime tokens will be very useful for developer to do secure
coding to check for some runtime Access Control Information or
preventing denial of service and maybe anti buffer over flowing attacks.
Perhaps the runtime special information are already available. If not,
that might be in the future version.
Thanks very much for the URL.
--
Matthew Ong
email: ongbp at yahoo.com
More information about the Digitalmars-d
mailing list